diff --git a/cores/arduino/stm32/analog.cpp b/cores/arduino/stm32/analog.cpp index 61feb5af4f..e3473e231d 100644 --- a/cores/arduino/stm32/analog.cpp +++ b/cores/arduino/stm32/analog.cpp @@ -916,7 +916,7 @@ uint16_t adc_read_value(PinName pin) !defined(STM32WBxx) && !defined(STM32F373xC) && !defined(STM32F378xx) AdcChannelConf.Offset = 0; /* Parameter discarded because offset correction is disabled */ #endif -#if defined (STM32H7xx) +#if defined (STM32H7xx) || defined(STM32MP1xx) AdcChannelConf.OffsetRightShift = DISABLE; /* No Right Offset Shift */ AdcChannelConf.OffsetSignedSaturation = DISABLE; /* Signed saturation feature is not used */ #endif @@ -929,12 +929,13 @@ uint16_t adc_read_value(PinName pin) #if defined(STM32F0xx) || defined(STM32F1xx) || defined(STM32F3xx) || \ defined(STM32G0xx) || defined(STM32G4xx) || defined(STM32H7xx) || \ - defined(STM32L0xx) || defined(STM32L4xx) || defined(STM32WBxx) + defined(STM32L0xx) || defined(STM32L4xx) || defined(STM32MP1xx) || \ + defined(STM32WBxx) /*##-2.1- Calibrate ADC then Start the conversion process ####################*/ #if defined(STM32F0xx) || defined(STM32G0xx) || defined(STM32F1xx) || \ defined(STM32F373xC) || defined(STM32F378xx) if (HAL_ADCEx_Calibration_Start(&AdcHandle) != HAL_OK) -#elif defined (STM32H7xx) +#elif defined (STM32H7xx) || defined(STM32MP1xx) if (HAL_ADCEx_Calibration_Start(&AdcHandle, ADC_CALIB_OFFSET, ADC_SINGLE_ENDED) != HAL_OK) #else if (HAL_ADCEx_Calibration_Start(&AdcHandle, ADC_SINGLE_ENDED) != HAL_OK) diff --git a/platform.txt b/platform.txt index be4c4dbef1..35cf6051f2 100644 --- a/platform.txt +++ b/platform.txt @@ -209,4 +209,4 @@ tools.remoteproc_gen.busybox.windows={path}/win/busybox.exe tools.remoteproc_gen.script=run_arduino_gen.sh tools.remoteproc_gen.upload.params.verbose= tools.remoteproc_gen.upload.params.quiet= -tools.remoteproc_gen.upload.pattern="{busybox}" sh "{path}/{script}" generate "{build.path}/{build.project_name}.elf" "{build.path}/run_arduino.sh" +tools.remoteproc_gen.upload.pattern="{busybox}" sh "{path}/{script}" generate "{build.path}/{build.project_name}.elf" "{build.path}/run_arduino_{build.project_name}.sh" diff --git a/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/condition.h b/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/condition.h index 7e8b19bf18..5202f3345f 100644 --- a/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/condition.h +++ b/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/condition.h @@ -19,7 +19,6 @@ #if defined (__CC_ARM) #include #endif -#include #include #include #include diff --git a/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/sys.h b/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/sys.h index 5a7d93b6f9..6f6143a4ce 100644 --- a/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/sys.h +++ b/system/Middlewares/OpenAMP/libmetal/lib/include/metal/system/generic/sys.h @@ -17,8 +17,6 @@ #define __METAL_GENERIC_SYS__H__ #include -#include -#include #include #include #include diff --git a/system/Middlewares/OpenAMP/libmetal/st_readme.txt b/system/Middlewares/OpenAMP/libmetal/st_readme.txt index 933da70fde..804ed14540 100644 --- a/system/Middlewares/OpenAMP/libmetal/st_readme.txt +++ b/system/Middlewares/OpenAMP/libmetal/st_readme.txt @@ -18,6 +18,14 @@ ****************************************************************************** @endverbatim +### V1.0.1/11-October-2019 ### +=============================== + + + Remove include files not used to fix compilation on IAR and KEIL + - lib/include/metal/system/generic/condition.h + - lib/include/metal/system/generic/sys.h + + ### V1.0.0/29-March-2019 ### =============================== + Integrate official release v2018.10 diff --git a/system/Middlewares/OpenAMP/mw_if/app_if/openamp_conf_template.h b/system/Middlewares/OpenAMP/mw_if/app_if/openamp_conf_template.h index ca60aac841..ec259ad05f 100644 --- a/system/Middlewares/OpenAMP/mw_if/app_if/openamp_conf_template.h +++ b/system/Middlewares/OpenAMP/mw_if/app_if/openamp_conf_template.h @@ -74,6 +74,13 @@ #endif /* VIRTUAL_I2C_MODULE_ENABLED */ + /* ########################## Linux Master Selection ############################## */ + /** + * @brief Due to Linux compatibility, it's important to distinguish if the MASTER is Linux or not. + * In that case, the LINUX_RPROC_MASTER define is required + */ +//#define LINUX_RPROC_MASTER + /* USER CODE BEGIN INCLUDE */ @@ -154,7 +161,7 @@ extern int __OPENAMP_region_end__[]; /* defined by linker script */ #endif -#if defined STM32MP157Cxx +#if defined LINUX_RPROC_MASTER #define VRING_RX_ADDRESS -1 /* allocated by Master processor: CA7 */ #define VRING_TX_ADDRESS -1 /* allocated by Master processor: CA7 */ #define VRING_BUFF_ADDRESS -1 /* allocated by Master processor: CA7 */ diff --git a/system/Middlewares/OpenAMP/mw_if/platform_if/rsc_table_template.c b/system/Middlewares/OpenAMP/mw_if/platform_if/rsc_table_template.c index 91c38c6234..67c7d19cff 100644 --- a/system/Middlewares/OpenAMP/mw_if/platform_if/rsc_table_template.c +++ b/system/Middlewares/OpenAMP/mw_if/platform_if/rsc_table_template.c @@ -61,7 +61,7 @@ #define __resource __section_t(.resource_table) #endif -#if defined (STM32MP157Cxx) +#if defined (LINUX_RPROC_MASTER) #ifdef VIRTIO_MASTER_ONLY #define CONST #else @@ -82,7 +82,7 @@ extern char system_log_buf[]; #endif #if defined(__GNUC__) -#if !defined (__CC_ARM) && !defined (STM32MP157Cxx) +#if !defined (__CC_ARM) && !defined (LINUX_RPROC_MASTER) /* Since GCC is not initializing the resource_table at startup, it is declared as volatile to avoid compiler optimization * for the CM4 (see resource_table_init() below) @@ -95,7 +95,7 @@ CONST struct shared_resource_table __resource __attribute__((used)) resource_tab __root CONST struct shared_resource_table resource_table @ ".resource_table" = { #endif -#if defined(__ICCARM__) || defined (__CC_ARM) || defined (STM32MP157Cxx) +#if defined(__ICCARM__) || defined (__CC_ARM) || defined (LINUX_RPROC_MASTER) .version = 1, #if defined (__LOG_TRACE_IO_) .num = 2, @@ -130,7 +130,7 @@ __root CONST struct shared_resource_table resource_table @ ".resource_table" = { void resource_table_init(int RPMsgRole, void **table_ptr, int *length) { -#if !defined (STM32MP157Cxx) +#if !defined (LINUX_RPROC_MASTER) #if defined (__GNUC__) && ! defined (__CC_ARM) #ifdef VIRTIO_MASTER_ONLY diff --git a/system/Middlewares/OpenAMP/mw_if/st_readme.txt b/system/Middlewares/OpenAMP/mw_if/st_readme.txt index c045278f6d..e3af4bff11 100644 --- a/system/Middlewares/OpenAMP/mw_if/st_readme.txt +++ b/system/Middlewares/OpenAMP/mw_if/st_readme.txt @@ -18,6 +18,11 @@ ****************************************************************************** @endverbatim +### V1.0.3/08-November-2019 ## +=============================== + + openamp_conf_template.h: + - replace the "STM32MP157Cxx" define macro with "LINUX_RPROC_MASTER" to support all STM32MP1 varieties + ### V1.0.2/29-July-2019 ### ============================ diff --git a/system/Middlewares/OpenAMP/open-amp/lib/include/openamp/rpmsg.h b/system/Middlewares/OpenAMP/open-amp/lib/include/openamp/rpmsg.h index 6c88d19d8d..983dcb094e 100644 --- a/system/Middlewares/OpenAMP/open-amp/lib/include/openamp/rpmsg.h +++ b/system/Middlewares/OpenAMP/open-amp/lib/include/openamp/rpmsg.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -25,7 +26,7 @@ extern "C" { /* Configurable parameters */ #define RPMSG_NAME_SIZE (32) -#define RPMSG_ADDR_BMP_SIZE (4) +#define RPMSG_ADDR_BMP_SIZE (128) #define RPMSG_NS_EPT_ADDR (0x35) #define RPMSG_ADDR_ANY 0xFFFFFFFF @@ -101,7 +102,7 @@ struct rpmsg_device_ops { struct rpmsg_device { struct metal_list endpoints; struct rpmsg_endpoint ns_ept; - unsigned long bitmap[RPMSG_ADDR_BMP_SIZE]; + unsigned long bitmap[metal_bitmap_longs(RPMSG_ADDR_BMP_SIZE)]; metal_mutex_t lock; rpmsg_ns_bind_cb ns_bind_cb; struct rpmsg_device_ops ops; diff --git a/system/Middlewares/OpenAMP/open-amp/lib/rpmsg/rpmsg.c b/system/Middlewares/OpenAMP/open-amp/lib/rpmsg/rpmsg.c index 9268889e07..0638a4f2e3 100644 --- a/system/Middlewares/OpenAMP/open-amp/lib/rpmsg/rpmsg.c +++ b/system/Middlewares/OpenAMP/open-amp/lib/rpmsg/rpmsg.c @@ -9,7 +9,6 @@ #include #include -#include #include "rpmsg_internal.h" diff --git a/system/Middlewares/OpenAMP/open-amp/st_readme.txt b/system/Middlewares/OpenAMP/open-amp/st_readme.txt index 3b4845d466..7c3b50ee63 100644 --- a/system/Middlewares/OpenAMP/open-amp/st_readme.txt +++ b/system/Middlewares/OpenAMP/open-amp/st_readme.txt @@ -19,6 +19,14 @@ @endverbatim +### V1.0.1/11-October-2019 ### +=============================== + + Change RPMSG_ADDR_BMP_SIZE to increase the number of Virtual UART instances + + -lib/include/openamp/rpmsg.h + -lib/rpmsg/rpmsg.c + + ### V1.0.0/29-March-2019 ### =============================== + Integrate official release v2018.10 diff --git a/variants/STM32MP157_DK/PeripheralPins.c b/variants/STM32MP157_DK/PeripheralPins.c index c9780fb4c9..8fa7ab9fea 100644 --- a/variants/STM32MP157_DK/PeripheralPins.c +++ b/variants/STM32MP157_DK/PeripheralPins.c @@ -30,46 +30,46 @@ WEAK const PinMap PinMap_ADC[] = { // {ANA_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)}, // ADC2_INP0 {ANA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC1_INP1 // {ANA_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // ADC2_INP1 - {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 - {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INN16 - {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 - {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 - {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 - {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 - {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 - {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INN18 - {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 - {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INN18 - {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 - {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 - {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 - {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INN3 - {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 - {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INN3 - {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 - {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INN5 - {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 - {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INN5 - {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 - {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 - {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 - {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 - {PC_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 - {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INN10 - {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 - {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INN10 - {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 - {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INN11 - {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_INP12 + // {PA_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16 + // {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INN16 + // {PA_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17 + // {PA_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14 + // {PA_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15 + // {PA_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18 + // {PA_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INP18 + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INN18 + // {PA_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19 + // {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC2_INN18 + // {PA_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC2_INP19 + // {PA_6, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INP3 + // {PA_6, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INP3 + // {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_INN3 + // {PA_7, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC1_INP7 + // {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC2_INN3 + // {PA_7, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)}, // ADC2_INP7 + // {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INN5 + // {PB_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC1_INP9 + // {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INN5 + // {PB_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)}, // ADC2_INP9 + // {PB_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC1_INP5 + // {PB_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)}, // ADC2_INP5 + // {PC_0, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INP10 + // {PC_0, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INP10 + // {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INN10 + // {PC_1, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INP11 + // {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC2_INN10 + // {PC_1, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC2_INP11 + // {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 11, 0)}, // ADC1_INN11 + // {PC_2, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_INP12 // {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 12, 0)}, // ADC1_INN12 {PC_3, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_INP13 - {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 - {PC_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 - {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INN4 - {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 - {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INN4 - {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 - {PF_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2 + // {PC_4, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INP4 + // {PC_4, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INP4 + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_INN4 + // {PC_5, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_INP8 + // {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC2_INN4 + // {PC_5, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC2_INP8 + // {PF_11, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INP2 // {PF_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC1_INN2 {PF_12, ADC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_INP6 {PF_13, ADC2, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // ADC2_INP2 diff --git a/variants/STM32MP157_DK/README.md b/variants/STM32MP157_DK/README.md index 3867332f4a..ac6c453883 100644 --- a/variants/STM32MP157_DK/README.md +++ b/variants/STM32MP157_DK/README.md @@ -13,49 +13,65 @@ Because every OS may have different software configurations (especially Device T * [STM32 MPU OpenSTLinux Distribution] * [Balena OS] -Note that the first two OSes should select `stm32mp157c-dk2-m4-examples-sdcard` boot mode (or device tree configuration) on boot time. `stm32mp157c-dk2-sdcard` boot mode is also known to work but it is not guaranteed. See [ST Wiki page on boot mode] for more detail. If you are using it for your own OS, see the [Linux Device Tree considerations](#Linux-Device-Tree-considerations) section. +#### Note + * Other distributions not listed here may run Arduino firmware but they are not tested. + * __The first two OSes should select `stm32mp157c-dk2-m4-examples-sdcard` boot mode (or device tree configuration) on boot time.__ + * `stm32mp157c-dk2-sdcard` boot mode is also known to work but it is not guaranteed. See [ST Wiki page on boot mode] for more detail. If you are using it for your own OS, see the [Linux Device Tree considerations](#Linux-Device-Tree-considerations) section. ## How to use After Verify and Upload, you will see a message similar to the following in Arduino IDE: - /run_arduino.sh generated successfully. + /run_arduino_.sh generated successfully. This file should be uploaded manually by SCP, SFTP, Kermit, or etc. - Then run "sh ./run_arduino.sh start" command in the board's console. + Then run "sh ./run_arduino_.sh start" command in the board's console. For detailed instructions, please visit: https://github.com/stm32duino/Arduino_Core_STM32/tree/master/variants/STM32MP157_DK/README.md -In this example, the user **must** upload `/run_arduino.sh` file manually. Uploading instruction is described later in the [Uploading](#Uploading) section. +`/run_arduino_.sh` looks like this for *Blink* example: -After uploading the user can use `sh run_arduino.sh start` in the console of host Linux via either SSH or Serial Console, to run the Arduino firmware. +* Windows: -Note: `sh run_arduino.sh start` is a one-shot command: the Arduino firmware only runs for the current boot. If you want to make it run after reboot, you need to use `sh run_arduino.sh install` command. + `C:/Users/%USERNAME%/AppData/Local/Temp/arduino_build_668148/run_arduino.Blink.sh` -`run_arduino.sh` help page summary: +* Linux/macOS: - Usage: sh run_arduino.sh [start|stop|restart|generate|install|uninstall] + `/tmp/arduino_build_668148/run_arduino_Blink.sh` - run_arduino.sh is a helper script that helps managing an Arduino binary +In this example, the user **must** upload `/run_arduino_.sh` file manually. Uploading instruction is described later in the [Uploading](#Uploading) section. + +After uploading the user can use `sh run_arduino_.sh start` in the console of host Linux via either SSH or Serial Console, to run the Arduino firmware. + +#### Note + * `sh run_arduino_.sh start` is a one-shot command, the Arduino firmware only runs for the current boot. If you want to make it run after reboot, you need to use `sh run_arduino_.sh install` command. + +`run_arduino_.sh` help page summary: + + Usage: sh run_arduino_.sh [start|stop|restart|generate|install|uninstall] + + run_arduino_.sh is a helper script that helps managing an Arduino binary file for the coprocessor using remoteproc framework. - sh run_arduino.sh start + sh run_arduino_.sh start Upload the binary to the coprocessor then start it. This command must be executed while the script contains the binary after generate command is run. - sh run_arduino.sh install + sh run_arduino_.sh install Run the binary on boot automatically by installing a systemd service. - sh run_arduino.sh uninstall + sh run_arduino_.sh uninstall Uninstall the autostart service. - sh run_arduino.sh stop + sh run_arduino_.sh stop Stop the coprocessor. - sh run_arduino.sh restart + sh run_arduino_.sh restart Restart the coprocessor. -See the source code for the full help page and the more details about [run_arduino.sh]. +See the source code [run_arduino_gen.sh] for the full help page and the more details about the `run_arduino_.sh` generated. + +[run_arduino_gen.sh] is the shell script that produces a copy of the script called `run_arduino_.sh` but with the sketch binary self-contained. ## Pin mapping @@ -96,7 +112,7 @@ There are additional pins for LEDs and buttons. ## Uploading -As mentioned above `run_arduino.sh` file should be uploaded manually in order to work. There are many ways to upload the file. +As mentioned above `run_arduino_.sh` file have to be uploaded manually from the PC to the board's Linux file system in order to be executed on the board directly through the board's Linux console. There are many ways to upload the file. ### Over Network @@ -152,7 +168,7 @@ And then the Device Tree should enable TIM1 for the coprocessor, although this d [Balena OS]: https://github.com/kbumsik/balena-st-stm32mp [ST Wiki page on boot mode]: https://wiki.st.com/stm32mpu/wiki/STM32CubeMP1_Package#Getting_started_with_STM32CubeMP1_Package -[run_arduino.sh]: https://github.com/stm32duino/Arduino_Tools/blob/master/linux/run_arduino_gen.sh +[run_arduino_gen.sh]: https://github.com/stm32duino/Arduino_Tools/blob/master/run_arduino_gen.sh [The ST Wiki page on C-Kermit]: https://wiki.st.com/stm32mpu/wiki/How_to_transfer_a_file_over_serial_console [a bug in OpenSTLinux]: https://community.st.com/s/question/0D50X0000B9vHa4/cannot-get-download-a-file-using-kermit diff --git a/variants/STM32MP157_DK/variant.cpp b/variants/STM32MP157_DK/variant.cpp index 64b2e59985..e455af5d0d 100644 --- a/variants/STM32MP157_DK/variant.cpp +++ b/variants/STM32MP157_DK/variant.cpp @@ -110,7 +110,6 @@ const PinName digitalPin[] = { ANA_1, //A3 - D22, D50 - ADC1_INP1 PC_3, //A4 - D23, D51 - ADC1_INP13, or PA_12 (D14) with SB23 ON / SB24 OFF PF_12 //A5 - D24, D52 - ADC1_INP6, or PA_11 (D15) with SB25 ON / SB26 OFF - // // Duplicated pins in order to be aligned with PinMap_ADC }; #ifdef __cplusplus @@ -150,6 +149,7 @@ void SystemClock_Config(void) RCC_OscInitTypeDef RCC_OscInitStruct = {}; RCC_ClkInitTypeDef RCC_ClkInitStruct = {}; + RCC_PeriphCLKInitTypeDef PeriphClkInit = {}; /**Configure LSE Drive Capability */ @@ -254,6 +254,19 @@ void SystemClock_Config(void) /**Set the HSE division factor for RTC clock */ __HAL_RCC_RTC_HSEDIV(24); + + /* Configure ADCx clock prescaler */ + PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC; + PeriphClkInit.AdcClockSelection = RCC_ADCCLKSOURCE_PER; + if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { + Error_Handler(); + } + + /* Configure VREFBUF */ + __HAL_RCC_VREF_CLK_ENABLE(); + HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE); + HAL_SYSCFG_EnableVREFBUF(); + } #ifdef __cplusplus