diff --git a/boards.json b/boards.json index 44aa2d2d67..465f58e6d2 100644 --- a/boards.json +++ b/boards.json @@ -99,5 +99,16 @@ } ] }, + + { + "modelnumber": "4917", + "board": "mcci_model_{{modelnumber}}", + "name": "MCCI Model {{modelnumber}}", + "pid": "00F1", + "build_board": "MCCI_MODEL_{{modelnumber}}", + "build_variant": "MODEL_4917", + "build_variant_extra_flags": "-DMCCI_MODEL_4917_PA0_SWITCHES_VDD=1", + "build_board_old_flags": "-DARDUINO_MODEL_{{modelnumber}}" + }, ] } diff --git a/boards.template b/boards.template index 1374af0054..21e6df85ff 100644 --- a/boards.template +++ b/boards.template @@ -5,7 +5,7 @@ # Input to generate_boards.bri, produces Arduino IDE boards.txt. # # Copyright: -# Copyright (c) 2018-2021 MCCI Corporation +# Copyright (c) 2018-2023 MCCI Corporation # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -32,7 +32,7 @@ # Define all the boards for this board support package to the Arduino IDE # # Copyright: -# Copyright (c) 2018-2021 MCCI Corporation +# Copyright (c) 2018-2023 MCCI Corporation # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff --git a/boards.txt b/boards.txt index 8c9d947252..a497907234 100644 --- a/boards.txt +++ b/boards.txt @@ -5,7 +5,7 @@ # Define all the boards for this board support package to the Arduino IDE # # Copyright: -# Copyright (c) 2018-2021 MCCI Corporation +# Copyright (c) 2018-2023 MCCI Corporation # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -1794,3 +1794,202 @@ mcci_catena_4802.menu.lorawan_subband.sb11.build.lorawan_subband_flags=-DARDUINO #### end of configuration info for MCCI Catena 4802 +# +# Configuration information for MCCI Model 4917 +# See template in https://github.com/mcci-catena/Arduino_Core_STM32/boards.template +# +mcci_model_4917.name=MCCI Model 4917 +mcci_model_4917.build.vid=0x040E +mcci_model_4917.build.pid=0x00F1 +mcci_model_4917.vid.0=0x040E +mcci_model_4917.pid.0=0x00F1 +mcci_model_4917.build.usb_product="MCCI Model 4917" +mcci_model_4917.build.usb_manufacturer="MCCI Corporation" + +mcci_model_4917.build.core=arduino +mcci_model_4917.build.board=MCCI_MODEL_4917 +mcci_model_4917.build.product_line=STM32L082xx + +mcci_model_4917.upload.maximum_size=196608 +mcci_model_4917.upload.maximum_data_size=20480 +mcci_model_4917.build.mcu=cortex-m0 +mcci_model_4917.build.series=STM32L0xx +mcci_model_4917.build.variant=MODEL_4917 +mcci_model_4917.build.variant_extra_flags=-DMCCI_MODEL_4917_PA0_SWITCHES_VDD=1 +mcci_model_4917.build.cmsis_lib_gcc=arm_cortexM0l_math +mcci_model_4917.build.ldscript= +mcci_model_4917.build.extra_flags=-DARDUINO_STM32 -DARDUINO_{build.series} -DARDUINO_{build.product_line} -DARDUINO_MODEL_4917 -D{build.product_line} {build.sysclk_flags} {build.xSerial} -D__CORTEX_SC=0 -D{build.board} {build.lorawan_flags} {build.lorawan_network_flags} {build.lorawan_subband_flags} {build.variant_extra_flags} +# mcci_model_4917.build.c.Werror= +# mcci_model_4917.build.cpp.Werror= +# mcci_model_4917.build.S.Werror= +mcci_model_4917.bootloader.tool=stm32l0_dfu +mcci_model_4917.bootloader.file=McciBootloader_46xx + +# +# menu.upload_method +mcci_model_4917.menu.upload_method.DFU_bl=DFU (include bootloader) +mcci_model_4917.menu.upload_method.DFU_bl.upload.tool=stm32l0_dfu_bootloader +mcci_model_4917.menu.upload_method.DFU_bl.upload.protocol=dfu +mcci_model_4917.menu.upload_method.DFU_bl.upload.maximum_size=172032 +mcci_model_4917.menu.upload_method.DFU_bl.upload.maximum_data_size=20480 + +mcci_model_4917.menu.upload_method.DFU=DFU +mcci_model_4917.menu.upload_method.DFU.upload.tool=stm32l0_dfu +mcci_model_4917.menu.upload_method.DFU.upload.protocol=dfu +mcci_model_4917.menu.upload_method.DFU.upload.maximum_size=196608 +mcci_model_4917.menu.upload_method.DFU.upload.maximum_data_size=20480 + +mcci_model_4917.menu.upload_method.STLink_bl=STLink (include bootloader) +mcci_model_4917.menu.upload_method.STLink_bl.upload.protocol=STLink +mcci_model_4917.menu.upload_method.STLink_bl.upload.tool=stlink_upload_bootloader +mcci_model_4917.menu.upload_method.STLink_bl.upload.maximum_size=172032 +mcci_model_4917.menu.upload_method.STLink_bl.upload.maximum_data_size=20480 + +mcci_model_4917.menu.upload_method.STLink=STLink +mcci_model_4917.menu.upload_method.STLink.upload.protocol=STLink +mcci_model_4917.menu.upload_method.STLink.upload.tool=stlink_upload +mcci_model_4917.menu.upload_method.STLink.upload.maximum_size=196608 +mcci_model_4917.menu.upload_method.STLink.upload.maximum_data_size=20480 + +#mcci_model_4917.menu.upload_method.Serial=Serial +#mcci_model_4917.menu.upload_method.Serial.upload.protocol=Serial +#mcci_model_4917.menu.upload_method.Serial.upload.tool=serial_upload + +# +# menu.xserial +mcci_model_4917.menu.xserial.usb=USB Serial +mcci_model_4917.menu.xserial.generic=Generic Serial +mcci_model_4917.menu.xserial.none=No Serial +mcci_model_4917.menu.xserial.usbhwserial=USB + HW Serial +mcci_model_4917.menu.xserial.usb.build.xSerial={build.usb_flags} -DARDUINO_BSP_CONFIG_SERIAL_MASK=0x1 +mcci_model_4917.menu.xserial.generic.build.xSerial=-DARDUINO_BSP_CONFIG_SERIAL_MASK=0x2 +mcci_model_4917.menu.xserial.none.build.xSerial=-DARDUINO_BSP_CONFIG_SERIAL_MASK=0x0 +mcci_model_4917.menu.xserial.usbhwserial.build.xSerial={build.usb_flags} -DARDUINO_BSP_CONFIG_SERIAL_MASK=0x3 + +# +# menu.sysclk +mcci_model_4917.menu.sysclk.pll32m=32 MHz (most power) +mcci_model_4917.menu.sysclk.pll24m=24 MHz +mcci_model_4917.menu.sysclk.hsi16m=16 MHz +mcci_model_4917.menu.sysclk.msi4194k=4.194 MHz (no USB) +mcci_model_4917.menu.sysclk.msi2097k=2.097 MHz (no USB, least power) +mcci_model_4917.menu.sysclk.pll32m.build.sysclk_flags=-DCATENA_CFG_SYSCLK=32 +mcci_model_4917.menu.sysclk.pll24m.build.sysclk_flags=-DCATENA_CFG_SYSCLK=24 +mcci_model_4917.menu.sysclk.hsi16m.build.sysclk_flags=-DCATENA_CFG_SYSCLK=16 +mcci_model_4917.menu.sysclk.msi4194k.build.sysclk_flags=-DCATENA_CFG_SYSCLK=4 +mcci_model_4917.menu.sysclk.msi2097k.build.sysclk_flags=-DCATENA_CFG_SYSCLK=2 + +# +# menu.bootloader +mcci_model_4917.menu.boot.trusted=MCCI Trusted Boot +mcci_model_4917.menu.boot.basic=Basic (no bootloader) + +# convert boot selections to settings +mcci_model_4917.menu.boot.basic.build.ldscript=../mcci-ldscript-basic.ld +mcci_model_4917.menu.boot.basic.build.baseaddr=0x08000000 +mcci_model_4917.menu.boot.trusted.build.ldscript=../mcci-ldscript-trusted.ld +mcci_model_4917.menu.boot.trusted.build.baseaddr=0x08005000 + +# +# menu.opt +mcci_model_4917.menu.opt.osstd=Smallest (-Os default) +mcci_model_4917.menu.opt.osstd.build.flags.optimize=-Os +mcci_model_4917.menu.opt.osstd.build.flags.ldspecs= +# mcci_model_4917.menu.opt.oslto=Smallest (-Os) with LTO +# mcci_model_4917.menu.opt.oslto.build.flags.optimize=-Os -flto +# mcci_model_4917.menu.opt.oslto.build.flags.ldspecs=-flto +mcci_model_4917.menu.opt.o1std=Fast (-O1) +mcci_model_4917.menu.opt.o1std.build.flags.optimize=-O1 +mcci_model_4917.menu.opt.o1std.build.flags.ldspecs= +# mcci_model_4917.menu.opt.o1lto=Fast (-O1) with LTO +# mcci_model_4917.menu.opt.o1lto.build.flags.optimize=-O1 -flto +# mcci_model_4917.menu.opt.o1lto.build.flags.ldspecs=-flto +mcci_model_4917.menu.opt.o2std=Faster (-O2) +mcci_model_4917.menu.opt.o2std.build.flags.optimize=-O2 +mcci_model_4917.menu.opt.o2std.build.flags.ldspecs= +# mcci_model_4917.menu.opt.o2lto=Faster (-O2) with LTO +# mcci_model_4917.menu.opt.o2lto.build.flags.optimize=-O2 -flto +# mcci_model_4917.menu.opt.o2lto.build.flags.ldspecs=-flto +mcci_model_4917.menu.opt.o3std=Fastest (-O3) +mcci_model_4917.menu.opt.o3std.build.flags.optimize=-O3 +mcci_model_4917.menu.opt.o3std.build.flags.ldspecs= +# mcci_model_4917.menu.opt.o3lto=Fastest (-O3) with LTO +# mcci_model_4917.menu.opt.o3lto.build.flags.optimize=-O3 -flto +# mcci_model_4917.menu.opt.o3lto.build.flags.ldspecs=-flto +mcci_model_4917.menu.opt.ogstd=Debug (-g) +mcci_model_4917.menu.opt.ogstd.build.flags.optimize=-Og -gdwarf-2 +mcci_model_4917.menu.opt.ogstd.build.flags.ldspecs= + +# +# menu.lorawan_region +mcci_model_4917.menu.lorawan_region.us915=North America 915 MHz +mcci_model_4917.menu.lorawan_region.eu868=Europe 868 MHz +mcci_model_4917.menu.lorawan_region.au915=Australia 915 MHz +mcci_model_4917.menu.lorawan_region.as923=Asia 923 MHz +mcci_model_4917.menu.lorawan_region.as923jp=Japan 923 MHz +mcci_model_4917.menu.lorawan_region.kr920=Korea 920 MHz +mcci_model_4917.menu.lorawan_region.in866=India 866 MHz +mcci_model_4917.menu.lorawan_region.projcfg=Use arduino-lmic/project_config/lmic_project_lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.us915.build.lorawan_flags=-DCFG_us915=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.eu868.build.lorawan_flags=-DCFG_eu868=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.au915.build.lorawan_flags=-DCFG_au921=1 -DCFG_au915=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.as923.build.lorawan_flags=-DCFG_as923=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.as923jp.build.lorawan_flags=-DCFG_as923=1 -DLMIC_COUNTRY_CODE=LMIC_COUNTRY_CODE_JP -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.kr920.build.lorawan_flags=-DCFG_kr920=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.in866.build.lorawan_flags=-DCFG_in866=1 -DCFG_sx1276_radio=1 -DARDUINO_LMIC_PROJECT_CONFIG_H=lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_region.projcfg.build.lorawan_flags= + +# +# menu.lorawan_network +mcci_model_4917.menu.lorawan_network.ttn=The Things Network +mcci_model_4917.menu.lorawan_network.ttn.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_TTN=1 +mcci_model_4917.menu.lorawan_network.actility=Actility ThingsPark +mcci_model_4917.menu.lorawan_network.actility.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_ACTILITY=1 +mcci_model_4917.menu.lorawan_network.helium=Helium +mcci_model_4917.menu.lorawan_network.helium.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_HELIUM=1 +mcci_model_4917.menu.lorawan_network.machineq=machineQ +mcci_model_4917.menu.lorawan_network.machineq.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_MACHINEQ=1 +mcci_model_4917.menu.lorawan_network.senet=Senet +mcci_model_4917.menu.lorawan_network.senet.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_SENET=1 +mcci_model_4917.menu.lorawan_network.senra=Senra +mcci_model_4917.menu.lorawan_network.senra.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_SENRA=1 +mcci_model_4917.menu.lorawan_network.swisscom=Swisscom +mcci_model_4917.menu.lorawan_network.swisscom.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_SWISSCOM=1 +mcci_model_4917.menu.lorawan_network.chirpstack=ChirpStack +mcci_model_4917.menu.lorawan_network.chirpstack.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_CHIRPSTACK=1 +mcci_model_4917.menu.lorawan_network.generic=Generic +mcci_model_4917.menu.lorawan_network.generic.build.lorawan_network_flags=-DARDUINO_LMIC_CFG_NETWORK_GENERIC=1 +mcci_model_4917.menu.lorawan_network.projcfg=Use arduino-lmic/project_config/lmic_project_lmic_config_preconditions.h +mcci_model_4917.menu.lorawan_network.projcfg.build.lorawan_network_flags= + +# +# menul.lorawan_subband +mcci_model_4917.menu.lorawan_subband.default=Default, works everywhere +mcci_model_4917.menu.lorawan_subband.default.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=-1 +mcci_model_4917.menu.lorawan_subband.sb0=sb0, ch 0~7 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb0.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=0 +mcci_model_4917.menu.lorawan_subband.sb1=sb1, ch 8~15 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb1.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=1 +mcci_model_4917.menu.lorawan_subband.sb2=sb2, ch 16~23 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb2.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=2 +mcci_model_4917.menu.lorawan_subband.sb3=sb3, ch 24~31 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb3.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=3 +mcci_model_4917.menu.lorawan_subband.sb4=sb4, ch 32~39 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb4.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=4 +mcci_model_4917.menu.lorawan_subband.sb5=sb5, ch 40~47 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb5.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=5 +mcci_model_4917.menu.lorawan_subband.sb6=sb6, ch 48~55 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb6.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=6 +mcci_model_4917.menu.lorawan_subband.sb7=sb7, ch 56~63 (US/AU/CN470) +mcci_model_4917.menu.lorawan_subband.sb7.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=7 +mcci_model_4917.menu.lorawan_subband.sb8=sb8, ch 64~71 (CN470) +mcci_model_4917.menu.lorawan_subband.sb8.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=8 +mcci_model_4917.menu.lorawan_subband.sb9=sb9, ch 72~79 (CN470) +mcci_model_4917.menu.lorawan_subband.sb9.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=9 +mcci_model_4917.menu.lorawan_subband.sb10=sb10, ch 80~87 (CN470) +mcci_model_4917.menu.lorawan_subband.sb10.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=10 +mcci_model_4917.menu.lorawan_subband.sb11=sb11, ch 88~95 (CN470) +mcci_model_4917.menu.lorawan_subband.sb11.build.lorawan_subband_flags=-DARDUINO_LMIC_CFG_SUBBAND=11 + +#### end of configuration info for MCCI Model 4917 + diff --git a/drivers/windows/MCCI-CATENA-STM32-DRIVER-INSTALLER.exe b/drivers/windows/MCCI-CATENA-STM32-DRIVER-INSTALLER.exe new file mode 100644 index 0000000000..dff094d98b Binary files /dev/null and b/drivers/windows/MCCI-CATENA-STM32-DRIVER-INSTALLER.exe differ diff --git a/drivers/windows/mcci-catena-stm32.cat b/drivers/windows/mcci-catena-stm32.cat index 459b293b2e..00ea89a436 100644 Binary files a/drivers/windows/mcci-catena-stm32.cat and b/drivers/windows/mcci-catena-stm32.cat differ diff --git a/drivers/windows/mcci-catena-stm32.inf b/drivers/windows/mcci-catena-stm32.inf index 80acbbe1ac..943944717b 100644 --- a/drivers/windows/mcci-catena-stm32.inf +++ b/drivers/windows/mcci-catena-stm32.inf @@ -5,7 +5,7 @@ ; Function: ; Installs the driver for MCCI Catena STM32 Version Boards ; -; Copyright (c) 2020 MCCI Corporation +; Copyright (c) 2020, 2023 MCCI Corporation ; ; MCCI is a registered trademark of MCCI Corporation. ; @@ -20,8 +20,9 @@ CatalogFile.nt = mcci-catena-stm32.cat CatalogFile.ntx86 = mcci-catena-stm32.cat CatalogFile.ntia64 = mcci-catena-stm32.cat CatalogFile.ntamd64 = mcci-catena-stm32.cat +PnpLockdown = 1 ; DriverVer date is MM/DD/YYYY -DriverVer=03/16/2020,1.0.0.0 +DriverVer=02/07/2023,10.0.22621.1194 [Manufacturer] %MFG%=MCCICatena, NT, NTx86, NTia64, NTamd64 @@ -34,6 +35,7 @@ DriverVer=03/16/2020,1.0.0.0 %mcci_catena_4617.name%=MCCICatenaInstall, USB\VID_040E&PID_00C1 %mcci_catena_4618.name%=MCCICatenaInstall, USB\VID_040E&PID_00D1 %mcci_catena_4630.name%=MCCICatenaInstall, USB\VID_040E&PID_00B1 +%mcci_catena_4917.name%=MCCICatenaInstall, USB\VID_040E&PID_00F1 [MCCICatena.NTx86] %mcci_catena_4551.name%=MCCICatenaInstall, USB\VID_040E&PID_0041 @@ -43,6 +45,7 @@ DriverVer=03/16/2020,1.0.0.0 %mcci_catena_4617.name%=MCCICatenaInstall, USB\VID_040E&PID_00C1 %mcci_catena_4618.name%=MCCICatenaInstall, USB\VID_040E&PID_00D1 %mcci_catena_4630.name%=MCCICatenaInstall, USB\VID_040E&PID_00B1 +%mcci_catena_4917.name%=MCCICatenaInstall, USB\VID_040E&PID_00F1 [MCCICatena.NTia64] %mcci_catena_4551.name%=MCCICatenaInstall, USB\VID_040E&PID_0041 @@ -52,6 +55,7 @@ DriverVer=03/16/2020,1.0.0.0 %mcci_catena_4617.name%=MCCICatenaInstall, USB\VID_040E&PID_00C1 %mcci_catena_4618.name%=MCCICatenaInstall, USB\VID_040E&PID_00D1 %mcci_catena_4630.name%=MCCICatenaInstall, USB\VID_040E&PID_00B1 +%mcci_catena_4917.name%=MCCICatenaInstall, USB\VID_040E&PID_00F1 [MCCICatena.NTamd64] %mcci_catena_4551.name%=MCCICatenaInstall, USB\VID_040E&PID_0041 @@ -61,6 +65,7 @@ DriverVer=03/16/2020,1.0.0.0 %mcci_catena_4617.name%=MCCICatenaInstall, USB\VID_040E&PID_00C1 %mcci_catena_4618.name%=MCCICatenaInstall, USB\VID_040E&PID_00D1 %mcci_catena_4630.name%=MCCICatenaInstall, USB\VID_040E&PID_00B1 +%mcci_catena_4917.name%=MCCICatenaInstall, USB\VID_040E&PID_00F1 [DestinationDirs] FakeModemCopyFileSection = 12 ;%windir%\system32\drivers @@ -173,4 +178,5 @@ mcci_catena_4612.name="MCCI Catena 4612" mcci_catena_4617.name="MCCI Catena 4617" mcci_catena_4618.name="MCCI Catena 4618" mcci_catena_4630.name="MCCI Catena 4630" +mcci_catena_4917.name="MCCI Catena 4917" ServiceName = "MCCI Catena STM32 USB Serial Driver" diff --git a/variants/MODEL_4917/PeripheralPins.c b/variants/MODEL_4917/PeripheralPins.c new file mode 100644 index 0000000000..efd09bc8b2 --- /dev/null +++ b/variants/MODEL_4917/PeripheralPins.c @@ -0,0 +1,258 @@ +/* + +Module: PeripheralPins.c + +Function: + Defines the special-function pins for this board. + +Copyright Notice: + Copyright (c) 2023, MCCI Corporation + Copyright (c) 2016, STMicroelectronics + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + 3. Neither the name of STMicroelectronics nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Authors: + STMicroelecronics + Dhinesh Kumar Pitchai, MCCI Corporation + +*/ + +#include "Arduino.h" +#include "PeripheralPins.h" + +// ===== +// Note: Commented lines are alternative possibilities which are not used per default. +// If you change them, you will have to know what you do +// ===== + + +//*** ADC *** + +#ifdef HAL_ADC_MODULE_ENABLED +const PinMap PinMap_ADC[] = { + {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC_IN0 +// {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC_IN1 + {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC_IN2 + {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC_IN3 + {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC_IN4 + {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC_IN5 +// {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC_IN6 +// {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC_IN7 +// {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC_IN8 +// {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC_IN9 +// {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC_IN10 +// {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC_IN11 +// {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC_IN12 + {NC, NP, 0} +}; +#endif + +//*** DAC *** + +#ifdef HAL_DAC_MODULE_ENABLED +const PinMap PinMap_DAC[] = { +// {PA_4, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC_OUT1 +// {PA_5, DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 + {NC, NP, 0} +}; +#endif + +//*** I2C *** + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SDA[] = { +// {PA_10, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)}, +// {PB_4, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF7_I2C3)}, +// {PB_7, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF1_I2C1)}, + {PB_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, +// {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)}, +// {PB_14, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C2)}, +// {PC_1, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF7_I2C3)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_I2C_MODULE_ENABLED +const PinMap PinMap_I2C_SCL[] = { +// {PA_8, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF7_I2C3)}, +// {PA_9, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C1)}, +// {PB_6, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF1_I2C1)}, + {PB_8, I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, +// {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C2)}, +// {PB_13, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF5_I2C2)}, +// {PC_0, I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF7_I2C3)}, + {NC, NP, 0} +}; +#endif + +//*** PWM *** + +#ifdef HAL_TIM_MODULE_ENABLED +const PinMap PinMap_PWM[] = { +// {PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 1, 0)}, // TIM2_CH1 +// {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2 +// {PA_2, TIM21, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM21, 1, 0)}, // TIM21_CH1 +// {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3 +// {PA_3, TIM21, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_TIM21, 2, 0)}, // TIM21_CH2 +// {PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 4, 0)}, // TIM2_CH4 +// {PA_5, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM2, 1, 0)}, // TIM2_CH1 +// {PA_6, TIM22, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM22, 1, 0)}, // TIM22_CH1 +// {PA_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 +// {PA_7, TIM22, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM22, 2, 0)}, // TIM22_CH2 +// {PA_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 +// {PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_TIM2, 1, 0)}, // TIM2_CH1 +// {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 +// {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 +// {PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 2, 0)}, // TIM2_CH2 +// {PB_4, TIM22, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM22, 1, 0)}, // TIM22_CH1 +// {PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 +// {PB_5, TIM22, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM22, 2, 0)}, // TIM22_CH2 +// {PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM3, 2, 0)}, // TIM3_CH2 +// {PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 3, 0)}, // TIM2_CH3 +// {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM2, 4, 0)}, // TIM2_CH4 +// {PB_13, TIM21, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_TIM21, 1, 0)}, // TIM21_CH1 +// {PB_14, TIM21, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_TIM21, 2, 0)}, // TIM21_CH2 + {NC, NP, 0} +}; +#endif + +//*** SERIAL *** + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_TX[] = { +// {PA_0, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART4)}, +// {PA_2, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, +// {PA_2, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, + {PA_9, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_USART1)}, +// {PA_14, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, +// {PA_14, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, +// {PB_3, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART5)}, +// {PB_6, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)}, +// {PB_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, +// {PB_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_LPUART1)}, +// {PC_1, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RX[] = { +// {PA_1, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART4)}, +// {PA_3, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, +// {PA_3, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, + {PA_10, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_USART1)}, +// {PA_13, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, +// {PA_15, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, +// {PB_4, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART5)}, +// {PB_7, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_USART1)}, +// {PB_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_LPUART1)}, +// {PB_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, +// {PC_0, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_LPUART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_RTS[] = { +// {PA_1, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, +// {PA_12, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, +// {PA_15, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART4)}, +// {PB_1, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, +// {PB_3, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_USART1)}, +// {PB_5, USART5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART5)}, +// {PB_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_LPUART1)}, +// {PB_14, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_UART_MODULE_ENABLED +const PinMap PinMap_UART_CTS[] = { +// {PA_0, USART2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART2)}, +// {PA_6, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, +// {PA_11, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, +// {PB_4, USART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_USART1)}, +// {PB_7, USART4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_USART4)}, +// {PB_13, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_LPUART1)}, + {NC, NP, 0} +}; +#endif + +//*** SPI *** + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MOSI[] = { + {PA_7, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI1)}, +// {PA_12, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, +// {PB_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_MISO[] = { + {PA_6, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI1)}, +// {PA_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, +// {PB_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI2)}, +// {PC_2, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SCLK[] = { +// {PA_5, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PB_3, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI1)}, +// {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI2)}, + {NC, NP, 0} +}; +#endif + +#ifdef HAL_SPI_MODULE_ENABLED +const PinMap PinMap_SPI_SSEL[] = { +// {PA_4, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI1)}, + {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI1)}, +// {PB_9, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, + {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI2)}, + {NC, NP, 0} +}; +#endif + +//*** CAN *** + +//*** No CAN_RD *** + +//*** No CAN_TD *** + +//*** ETHERNET *** + +//*** No Ethernet *** + +//*** QUADSPI *** + +//*** No QUADSPI *** diff --git a/variants/MODEL_4917/override_usbd_ll_connectionstate.c b/variants/MODEL_4917/override_usbd_ll_connectionstate.c new file mode 100644 index 0000000000..52219fba1a --- /dev/null +++ b/variants/MODEL_4917/override_usbd_ll_connectionstate.c @@ -0,0 +1,49 @@ +/* + +Module: override_usbd_ll_connectionstate.c + +Function: + Override USBD_LL_ConnectionState() function for CATENA_4917 variant. + +Copyright notice and license information: + Copyright 2018-2023 MCCI Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + +Author: + Dhinesh Kumar Pitchai, MCCI Corporation + +*/ + +#include +#include + +#ifdef USBCON + +/** + * @brief Get USB connection state + * @param None + * @retval 0 if disconnected + */ +USBD_LL_ConnectionState_WEAK uint32_t USBD_LL_ConnectionState(void) +{ + uint32_t vBus; + + vBus = analogRead(18); + return vBus > 270 ? 1 : 0; +} + +#endif // USBCON diff --git a/variants/MODEL_4917/readme.txt b/variants/MODEL_4917/readme.txt new file mode 100644 index 0000000000..aa78ef9c7c --- /dev/null +++ b/variants/MODEL_4917/readme.txt @@ -0,0 +1,4 @@ +This the variant directory for the Model 4917. + +For background, see the stm32duino Wiki: +https://github.com/stm32duino/wiki/wiki/Add-a-new-variant-(board) \ No newline at end of file diff --git a/variants/MODEL_4917/stm32l0xx_hal_conf.h b/variants/MODEL_4917/stm32l0xx_hal_conf.h new file mode 100644 index 0000000000..d521e8f65f --- /dev/null +++ b/variants/MODEL_4917/stm32l0xx_hal_conf.h @@ -0,0 +1,313 @@ +/** + ****************************************************************************** + * @file stm32l0xx_hal_conf.h + * @brief HAL configuration file. + ****************************************************************************** + * @attention + * + *

© COPYRIGHT(c) 2017 STMicroelectronics

+ *

© COPYRIGHT(c) 2023 MCCI Corporation

+ * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************** + */ + +/* Define to prevent recursive inclusion -------------------------------------*/ +#ifndef __STM32L0xx_HAL_CONF_H +#define __STM32L0xx_HAL_CONF_H + +#ifdef __cplusplus + extern "C" { +#endif + +/* Exported types ------------------------------------------------------------*/ +/* Exported constants --------------------------------------------------------*/ + +/* ########################## Module Selection ############################## */ +/** + * @brief This is the list of modules to be used in the HAL driver + */ + +#define HAL_MODULE_ENABLED +#define HAL_ADC_MODULE_ENABLED +/*#define HAL_CRYP_MODULE_ENABLED */ +/*#define HAL_COMP_MODULE_ENABLED */ +/*#define HAL_CRC_MODULE_ENABLED */ +/*#define HAL_CRYP_MODULE_ENABLED */ +/*#define HAL_DAC_MODULE_ENABLED */ +/*#define HAL_FIREWALL_MODULE_ENABLED */ +/*#define HAL_I2S_MODULE_ENABLED */ +/*#define HAL_IWDG_MODULE_ENABLED */ +/*#define HAL_LCD_MODULE_ENABLED */ +/*#define HAL_LPTIM_MODULE_ENABLED */ +/*#define HAL_RNG_MODULE_ENABLED */ +#define HAL_RTC_MODULE_ENABLED +#define HAL_SPI_MODULE_ENABLED +#define HAL_TIM_MODULE_ENABLED +/*#define HAL_TSC_MODULE_ENABLED */ +#define HAL_UART_MODULE_ENABLED +/*#define HAL_USART_MODULE_ENABLED */ +/*#define HAL_IRDA_MODULE_ENABLED */ +/*#define HAL_SMARTCARD_MODULE_ENABLED */ +/*#define HAL_SMBUS_MODULE_ENABLED */ +/*#define HAL_WWDG_MODULE_ENABLED */ +#ifdef USBCON +# define HAL_PCD_MODULE_ENABLED +#endif +#define HAL_GPIO_MODULE_ENABLED +#define HAL_DMA_MODULE_ENABLED +#define HAL_I2C_MODULE_ENABLED +#define HAL_RCC_MODULE_ENABLED +#define HAL_FLASH_MODULE_ENABLED +#define HAL_PWR_MODULE_ENABLED +#define HAL_CORTEX_MODULE_ENABLED + +/* ########################## Oscillator Values adaptation ####################*/ +/** + * @brief Adjust the value of External High Speed oscillator (HSE) used in your application. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSE is used as system clock source, directly or through the PLL). + */ +#if !defined (HSE_VALUE) + #define HSE_VALUE ((uint32_t)8000000U) /*!< Value of the External oscillator in Hz */ +#endif /* HSE_VALUE */ + +#if !defined (HSE_STARTUP_TIMEOUT) + #define HSE_STARTUP_TIMEOUT ((uint32_t)100U) /*!< Time out for HSE start up, in ms */ +#endif /* HSE_STARTUP_TIMEOUT */ + +/** + * @brief Internal Multiple Speed oscillator (MSI) default value. + * This value is the default MSI range value after Reset. + */ +#if !defined (MSI_VALUE) + #define MSI_VALUE ((uint32_t)2097000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* MSI_VALUE */ + +/** + * @brief Internal High Speed oscillator (HSI) value. + * This value is used by the RCC HAL module to compute the system frequency + * (when HSI is used as system clock source, directly or through the PLL). + */ +#if !defined (HSI_VALUE) + #define HSI_VALUE ((uint32_t)16000000U) /*!< Value of the Internal oscillator in Hz*/ +#endif /* HSI_VALUE */ + +/** + * @brief Internal High Speed oscillator for USB (HSI48) value. + */ +#if !defined (HSI48_VALUE) +#define HSI48_VALUE ((uint32_t)48000000U) /*!< Value of the Internal High Speed oscillator for USB in Hz. + The real value may vary depending on the variations + in voltage and temperature. */ +#endif /* HSI48_VALUE */ + +/** + * @brief Internal Low Speed oscillator (LSI) value. + */ +#if !defined (LSI_VALUE) + #define LSI_VALUE ((uint32_t)37000U) /*!< LSI Typical Value in Hz*/ +#endif /* LSI_VALUE */ /*!< Value of the Internal Low Speed oscillator in Hz + The real value may vary depending on the variations + in voltage and temperature.*/ +/** + * @brief External Low Speed oscillator (LSE) value. + * This value is used by the UART, RTC HAL module to compute the system frequency + */ +#if !defined (LSE_VALUE) + #define LSE_VALUE ((uint32_t)32768U) /*!< Value of the External oscillator in Hz*/ +#endif /* LSE_VALUE */ + +#if !defined (LSE_STARTUP_TIMEOUT) + #define LSE_STARTUP_TIMEOUT ((uint32_t)5000U) /*!< Time out for LSE start up, in ms */ +#endif /* LSE_STARTUP_TIMEOUT */ + +/* Tip: To avoid modifying this file each time you need to use different HSE, + === you can define the HSE value in your toolchain compiler preprocessor. */ + +/* ########################### System Configuration ######################### */ +/** + * @brief This is the HAL system configuration section + */ +#define VDD_VALUE ((uint32_t)3300U) /*!< Value of VDD in mv */ +#define TICK_INT_PRIORITY ((uint32_t)0U) /*!< tick interrupt priority */ +#define USE_RTOS 0U +#define PREFETCH_ENABLE 0U +#define PREREAD_ENABLE 1U +#define BUFFER_CACHE_DISABLE 0U + +/* ########################## Assert Selection ############################## */ +/** + * @brief Uncomment the line below to expanse the "assert_param" macro in the + * HAL drivers code + */ +/* #define USE_FULL_ASSERT 1 */ + +/* Includes ------------------------------------------------------------------*/ +/** + * @brief Include module's header file + */ + +#ifdef HAL_RCC_MODULE_ENABLED + #include "stm32l0xx_hal_rcc.h" +#endif /* HAL_RCC_MODULE_ENABLED */ + +#ifdef HAL_GPIO_MODULE_ENABLED + #include "stm32l0xx_hal_gpio.h" +#endif /* HAL_GPIO_MODULE_ENABLED */ + +#ifdef HAL_DMA_MODULE_ENABLED + #include "stm32l0xx_hal_dma.h" +#endif /* HAL_DMA_MODULE_ENABLED */ + +#ifdef HAL_CORTEX_MODULE_ENABLED + #include "stm32l0xx_hal_cortex.h" +#endif /* HAL_CORTEX_MODULE_ENABLED */ + +#ifdef HAL_ADC_MODULE_ENABLED + #include "stm32l0xx_hal_adc.h" +#endif /* HAL_ADC_MODULE_ENABLED */ + +#ifdef HAL_COMP_MODULE_ENABLED + #include "stm32l0xx_hal_comp.h" +#endif /* HAL_COMP_MODULE_ENABLED */ + +#ifdef HAL_CRC_MODULE_ENABLED + #include "stm32l0xx_hal_crc.h" +#endif /* HAL_CRC_MODULE_ENABLED */ + +#ifdef HAL_CRYP_MODULE_ENABLED + #include "stm32l0xx_hal_cryp.h" +#endif /* HAL_CRYP_MODULE_ENABLED */ + +#ifdef HAL_DAC_MODULE_ENABLED + #include "stm32l0xx_hal_dac.h" +#endif /* HAL_DAC_MODULE_ENABLED */ + +#ifdef HAL_FIREWALL_MODULE_ENABLED + #include "stm32l0xx_hal_firewall.h" +#endif /* HAL_FIREWALL_MODULE_ENABLED */ + +#ifdef HAL_FLASH_MODULE_ENABLED + #include "stm32l0xx_hal_flash.h" +#endif /* HAL_FLASH_MODULE_ENABLED */ + +#ifdef HAL_I2C_MODULE_ENABLED + #include "stm32l0xx_hal_i2c.h" +#endif /* HAL_I2C_MODULE_ENABLED */ + +#ifdef HAL_I2S_MODULE_ENABLED + #include "stm32l0xx_hal_i2s.h" +#endif /* HAL_I2S_MODULE_ENABLED */ + +#ifdef HAL_IWDG_MODULE_ENABLED + #include "stm32l0xx_hal_iwdg.h" +#endif /* HAL_IWDG_MODULE_ENABLED */ + +#ifdef HAL_LCD_MODULE_ENABLED + #include "stm32l0xx_hal_lcd.h" +#endif /* HAL_LCD_MODULE_ENABLED */ + +#ifdef HAL_LPTIM_MODULE_ENABLED +#include "stm32l0xx_hal_lptim.h" +#endif /* HAL_LPTIM_MODULE_ENABLED */ + +#ifdef HAL_PWR_MODULE_ENABLED + #include "stm32l0xx_hal_pwr.h" +#endif /* HAL_PWR_MODULE_ENABLED */ + +#ifdef HAL_RNG_MODULE_ENABLED + #include "stm32l0xx_hal_rng.h" +#endif /* HAL_RNG_MODULE_ENABLED */ + +#ifdef HAL_RTC_MODULE_ENABLED + #include "stm32l0xx_hal_rtc.h" + +#endif /* HAL_RTC_MODULE_ENABLED */ + +#ifdef HAL_SPI_MODULE_ENABLED + #include "stm32l0xx_hal_spi.h" +#endif /* HAL_SPI_MODULE_ENABLED */ + +#ifdef HAL_TIM_MODULE_ENABLED + #include "stm32l0xx_hal_tim.h" +#endif /* HAL_TIM_MODULE_ENABLED */ + +#ifdef HAL_TSC_MODULE_ENABLED + #include "stm32l0xx_hal_tsc.h" +#endif /* HAL_TSC_MODULE_ENABLED */ + +#ifdef HAL_UART_MODULE_ENABLED + #include "stm32l0xx_hal_uart.h" +#endif /* HAL_UART_MODULE_ENABLED */ + +#ifdef HAL_USART_MODULE_ENABLED + #include "stm32l0xx_hal_usart.h" +#endif /* HAL_USART_MODULE_ENABLED */ + +#ifdef HAL_IRDA_MODULE_ENABLED + #include "stm32l0xx_hal_irda.h" +#endif /* HAL_IRDA_MODULE_ENABLED */ + +#ifdef HAL_SMARTCARD_MODULE_ENABLED + #include "stm32l0xx_hal_smartcard.h" +#endif /* HAL_SMARTCARD_MODULE_ENABLED */ + +#ifdef HAL_SMBUS_MODULE_ENABLED + #include "stm32l0xx_hal_smbus.h" +#endif /* HAL_SMBUS_MODULE_ENABLED */ + +#ifdef HAL_WWDG_MODULE_ENABLED + #include "stm32l0xx_hal_wwdg.h" +#endif /* HAL_WWDG_MODULE_ENABLED */ + +#ifdef HAL_PCD_MODULE_ENABLED + #include "stm32l0xx_hal_pcd.h" +#endif /* HAL_PCD_MODULE_ENABLED */ + +/* Exported macro ------------------------------------------------------------*/ +#ifdef USE_FULL_ASSERT +/** + * @brief The assert_param macro is used for function's parameters check. + * @param expr: If expr is false, it calls assert_failed function + * which reports the name of the source file and the source + * line number of the call that failed. + * If expr is true, it returns no value. + * @retval None + */ + #define assert_param(expr) ((expr) ? (void)0U : assert_failed((char *)__FILE__, __LINE__)) +/* Exported functions ------------------------------------------------------- */ + void assert_failed(char *file, uint32_t line); +#else + #define assert_param(expr) ((void)0U) +#endif /* USE_FULL_ASSERT */ + +#ifdef __cplusplus +} +#endif + +#endif /* __STM32L0xx_HAL_CONF_H */ + + +/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/variants/MODEL_4917/variant.cpp b/variants/MODEL_4917/variant.cpp new file mode 100644 index 0000000000..207e4bc637 --- /dev/null +++ b/variants/MODEL_4917/variant.cpp @@ -0,0 +1,73 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + Copyright (c) 2023 MCCI Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "variant.h" +#include "stm32l0xx_ll_rcc.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Pin number +// This array allows to map Arduino pin number(Dx or x) +// to STM32 PinName (PX_n) -- don't forget to also change variant.h +const PinName digitalPin[] = { +//PX_n, //Dx + PA_10, //D0 D0_UART_RX JP3-3 + PA_9, //D1 D1_UART_TX JP3-2 + PA_7, //D2 RADIO_MOSI + PA_6, //D3 RADIO_MISO + PB_3, //D4 RADIO_SCK + PB_6, //D5 D5 + PA_13, //D6 D6_SWDIO JP2-4 + PA_15, //D7 RADIO_NSS + PC_0, //D8 RADIO_RESET + PA_14, //D9 D9_SWCLK JP2-5 + PH_1, //D10 D10 + PB_5, //D11 D11 + PB_7, //D12 D12 + PB_2, //D13 D13_LED + PA_0, //D14/A0 Controls boost regulator on Catena 4917 JP1-12 + PA_5, //D15/A1 A1 JP4-2 + PA_4, //D16/A2 A2 JP4-3 + PA_3, //D17/A3 A3_VBAT_MON + PA_2, //D18/A4 A4_VBUS_MON + PB_12, //D19 NSS + PB_9, //D20 SDA + PB_8, //D21 SCL + PB_14, //D22 MISO + PB_15, //D23 MOSI + PB_13, //D24 SCK + PB_4, //D25 RADIO_DIO_0 + PB_1, //D26 RADIO_DIO_1 + PB_0, //D27 RADIO_DIO_2 + PC_13, //D28 RADIO_DIO_3 + PA_1, //D29 RADIO_ANT_SWITCH_RX CRF1 + PC_1, //D30 RADIO_ANT_SWITCH_TX_BOOST CRF3 + PC_2, //D31 RADIO_ANT_SWITCH_TX_RFO CRF2 + NC, //D32 Flash Write-Protect (not supported these platforms) + PA_8, //D33 RADIO_TCXO +}; + +#ifdef __cplusplus +} +#endif + +// ---------------------------------------------------------------------------- + diff --git a/variants/MODEL_4917/variant.h b/variants/MODEL_4917/variant.h new file mode 100644 index 0000000000..3aa10cb23b --- /dev/null +++ b/variants/MODEL_4917/variant.h @@ -0,0 +1,153 @@ +/* + Copyright (c) 2011 Arduino. All right reserved. + Copyright (c) 2023 MCCI Corporation. All rights reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _VARIANT_ARDUINO_MODEL_4917_ +#define _VARIANT_ARDUINO_MODEL_4917_ + +/*---------------------------------------------------------------------------- + * Headers + *----------------------------------------------------------------------------*/ +#include "PeripheralPins.h" + +#ifdef __cplusplus +extern "C"{ +#endif // __cplusplus + +/*---------------------------------------------------------------------------- + * Pins + *----------------------------------------------------------------------------*/ +extern const PinName digitalPin[]; + +// Enum defining pin names to match digital pin number --> Dx +// !!! +// !!! Copy the digitalPin[] array in variant.cpp +// !!! and remove all '_': PX_n --> PXn +// !!! For NC, suffix by _x where x is the number of NC: +// !!! NC_1, NC_2,... +// !!! For duplicated pin name, suffix by _x where x is the number of pin: +// !!! PA7, PA7_2, PA7_3,... +enum { + PA10, //D0 D0_RX + PA9, //D1 D1_TX + PA7, //D2 RADIO_MOSI Murata internal + PA6, //D3 RADIO_MISO Murata internal + PB3, //D4 RADIO_SCK Murata internal + PB6, //D5 D5 + PA13, //D6 D6_SWDIO + PA15, //D7 RADIO_NSS Murata internal + PC0, //D8 RADIO_RESET Murata internal + PA14, //D9 D9_SWCLK + PH1, //D10 D10 + PB5, //D11 D11 + PB7, //D12 D12 + PB2, //D13 D13_LED + PA0, //D14/A0 Controls boost regulator on Catena 4917 + PA5, //D15/A1 + PA4, //D16/A2 + PA3, //D17/A3 A3_VBAT_DET + PA2, //D18/A4 A4_VBUS_DET + PB12, //D19 NSS + PB9, //D20 SDA + PB8, //D21 SCL + PB14, //D22 MISO + PB15, //D23 MOSI + PB13, //D24 SCK + PB4, //D25 RADIO_DIO_0 Murata internal + PB1, //D26 RADIO_DIO_1 Murata internal + PB0, //D27 RADIO_DIO_2 Murata internal + PC13, //D28 RADIO_DIO_3 Murata internal + PA1, //D29 RADIO_ANT_SWITCH_RX CRF1 Murata internal + PC1, //D30 RADIO_ANT_SWITCH_TX_BOOST CRF3 Murata internal + PC2, //D31 RADIO_ANT_SWITCH_TX_RFO CRF2 Murata internal + NC_1, //D32 Flash Write-Protect (not supported these platforms) + PA8, //D33 + PEND +}; + +// This must be a literal with the same value as PEND +#define NUM_DIGITAL_PINS 34 +// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS +#define NUM_ANALOG_INPUTS 5 +#define NUM_ANALOG_FIRST 14 + +//On-board LED pin number +#define LED_BUILTIN D13 +#define LED_RED LED_BUILTIN + +//On-board user button +//#define USER_BTN NC + + +//SPI definitions +#define RADIO_SS D7 +#define RADIO_MOSI D2 +#define RADIO_MISO D3 +#define RADIO_SCK D4 +#define RADIO_RESET D8 +#define RADIO_TCXO D33 +#define RADIO_DIO_0 D25 +#define RADIO_DIO_1 D26 +#define RADIO_DIO_2 D27 +#define RADIO_DIO_3 D28 + +#define FLASH_SS D19 +#define FLASH_MOSI D23 +#define FLASH_MISO D22 +#define FLASH_SCK D24 + +#define PIN_SPI_SS RADIO_SS // Default for Arduino connector compatibility +#define PIN_SPI_MOSI RADIO_MOSI // Default for Arduino connector compatibility +#define PIN_SPI_MISO RADIO_MISO // Default for Arduino connector compatibility +#define PIN_SPI_SCK RADIO_SCK // Default for Arduino connector compatibility + +//I2C Definitions +#define PIN_WIRE_SDA D20 // Default for Arduino connector compatibility +#define PIN_WIRE_SCL D21 // Default for Arduino connector compatibility + +//Timer Definitions +//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c +#define TIMER_TONE TIM3 + +//Do not use basic timer: OC is required +#define TIMER_SERVO TIM2 //TODO: advanced-control timers don't work + +// UART Definitions + +#ifdef __cplusplus +} // extern "C" +#endif + +// These serial port names are intended to allow libraries and architecture-neutral +// sketches to automatically default to the correct port name for a particular type +// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN, +// the first hardware serial port whose RX/TX pins are not dedicated to another use. +// +// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor +// +// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial +// +// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library +// +// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins. +// +// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX +// pins are NOT connected to anything by default. +#include "../mcci_common_uart.h" + +#endif /* _VARIANT_ARDUINO_MODEL_4917_ */