aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32
AgeCommit message (Collapse)Author
2021-04-27Add OpenMano boardHEADmasterAditya Naik
Added board hardware configuration to micropython ports/stm32/boards directory.
2021-04-28stm32/uart: Fix H7 UART clock source configuration.iabdalkader
Previously to this commit, Usart16ClockSelection was overwritten and Usart234578ClockSelection was not set.
2021-04-28stm32,teensy: Correct typos in project README files.plan-do-break-fix
2021-04-23stm32/mboot: Allow unpacking dfu without secret key.David Michieli
- unpack-dfu command no longer requies a secret key to be present - pack-dfu command raises an exception if no secret key is found
2021-04-21stm32/machine_timer: Improve usability of Timer constructor and init.Damien George
Improvements are: - Default period is 1000ms with callback disabled. - if period is not specified then it's not updated (previously, if period was not specified then it was set to -1 and running the timer callback as fast as possible, making the REPL unresponsive). - Use uint64_t to compute delta_ms, and raise a ValueError if the period is too large. - If callback is not specified then it's not updated. - Specifying None for the callback will disable the timer. Signed-off-by: Damien George <damien@micropython.org>
2021-04-20stm32/boards/pllvalues.py: Support wider range of PLL values for F413.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-14stm32/sdram: Make MICROPY_HW_FMC_BA1,MICROPY_HW_FMC_A11 optional pins.8bitgeek
This supports SDRAM having only 2 internal banks (using BA0 only), and only 11 (A0-A10) bits of address, such as IS42S16100H (512K x 16bit x 2bank).
2021-04-13stm32/uart: Use LL_USART_GetBaudRate to compute baudrate.Damien George
This function includes the UART prescaler in the calculation (if it has one, eg on H7 and WB MCUs). Signed-off-by: Damien George <damien@micropython.org>
2021-04-13stm32/boards: Split UARTx_RTS_DE into UARTx_RTS/UARTx_DE in pin defs.Damien George
So these alternate functions can be parsed by the build scripts and used in application code. Signed-off-by: Damien George <damien@micropython.org>
2021-04-12stm32/rfcore: Intercept addr-resolution HCI cmd to work around BLE bug.Damien George
The STM32WB has a problem when address resolution is enabled: under certain conditions the MCU can get into a state where it draws an additional 10mA or so and eventually ends up with a broken BLE RX path in the silicon. A simple way to reproduce this is to enable address resolution (which is the default for NimBLE) and start the device advertising. If there is enough BLE activity in the vicinity then the device will at some point enter the bad state and, if left long enough, will have permanent BLE RX damage. STMicroelectronics are aware of this issue. The only known workaround at this stage is to not enable address resolution, which is implemented by this commit. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <damien@micropython.org>
2021-04-12stm32/rfcore: Fix race condition with C2 accessing free buffer list.Damien George
Prior to this commit, if C2 was busy (eg lots of BLE activity) then it may not have had time to respond to the notification on the IPCC_CH_MM channel by the time additional memory was available to put on that buffer. In such a case C1 would modify the free buffer list while C2 was potentially accessing it, and this would eventually lead to lost memory buffers (or a corrupt linked list). If all buffers become lost then ACL packets (asynchronous events) can no longer be delivered from C2 to C1. This commit fixes this issue by waiting for C2 to indicate that it has finished using the free buffer list. Work done in collaboration with Jim Mussared aka @jimmo. Signed-off-by: Damien George <damien@micropython.org>
2021-04-09stm32/boards/NUCLEO_L476RG: Add 5 remaining UARTs.aziubin
STM32L476RG MCU of NUCLEO_L476RG board has 6 UART/USART units in total (USART1, USART2, USART3, UART4, UART5 and LPUART1), but only UART2, connected to REPL, was defined and available in Python code. Defined are all 5 remaining UART/USART units including LPUART1. Signed-off-by: Alexander Ziubin aziubin@googlemail.com
2021-04-09stm32/boardctrl: Give boards control over execution of boot.py,main.py.Damien George
This commit simplifies the customisation of the main MicroPython execution loop (4 macros are reduced to 2), and allows a board to have full control over the execution (or not) of boot.py and main.py. For boards that use the default start-up code, there is no functional change in this commit. Signed-off-by: Damien George <damien@micropython.org>
2021-04-08stm32/mpconfigport.h: Add support for a board to specify root pointers.Damien George
A board can now define MICROPY_BOARD_ROOT_POINTERS to specify any custom root pointers. Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/boards/pllvalues.py: Relax PLLQ constraints on STM32F413 MCUs.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/powerctrl: Support using PLLI2C on STM32F413 as USB clock source.Damien George
So SYSCLK can run at more varied frequencies, eg 100MHz. Signed-off-by: Damien George <damien@micropython.org>
2021-04-07stm32/powerctrl: Allow a board to configure AHB and APB clock dividers.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-04-06stm32: Include .ARM section in firmware for C++ exception handling.Damien George
Support for C++ was added in 97960dc7deb7a0e691fca5944402cd03386b744b but that commit didn't include the C++ exception handling table in the binary firmware image. This commit fixes that. Signed-off-by: Damien George <damien@micropython.org>
2021-03-17stm32/Makefile: Allow QSTR_DEFS,QSTR_GLOBAL_DEPENDENCIES to be extended.Damien George
So a board can provide custom qstr definitions if needed. Signed-off-by: Damien George <damien@micropython.org>
2021-03-16stm32/Makefile: Fix C++ linker flags when toolchain has spaces in path.stijn
The GNU Make dir command uses spaces as item separator so it does not work for e.g building the STM32 port on Cygwin with a default Arm installation in "c:/program files (x86)/GNU Arm Embedded Toolchain". Fix by using POSIX dirname on a quoted path instead.
2021-03-11stm32/boardctrl: Add MICROPY_BOARD_STARTUP hook.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-03-11stm32/spi: Fix baudrate calculation for H7 series.Reinhard Feger
Fixes issue #6342.
2021-03-11stm32/powerctrl: Save and restore EWUP state when configuring standby.Peter Hinch
This allows the user to enable wake-up sources using the EWUP bits, on F7 MCUs. Disabling the wake-up sources while clearing the wake-up flags follows the reference manual and ST examples.
2021-03-10stm32/main: Fix passing state.reset_mode to init_flash_fs.Braiden Kindt
state.reset_mode is updated by `MICROPY_BOARD_BEFORE_SOFT_RESET_LOOP` but not passed to `init_flash_fs`, and so factory reset is not executed on boards that do not have a bootloader. This bug was introduced by 4c3976bbcaf58266fdcaab264fee5b7a94a682e5 Fixes #6903.
2021-03-10stm32/make-stmconst.py: Allow "[]" chars when parsing source comments.Herwin Grobben
For STM32WB MCUs, EXTI offset addresses were not parsed due to the appearance of "[31:0]" in a comment in the .h file.
2021-03-09stm32/storage: Prevent attempts to read/write invalid block addresses.Andrew Leech
A corrupt filesystem may lead to a request for a block which is out of range of the block device limits. Return an error instead of passing the request down to the lower layer.
2021-03-02stm32/rfcore: Allow BLE settings to be changed by a board.Damien George
Two of the defaults have also changed in this commit: - MICROPY_HW_RFCORE_BLE_LSE_SOURCE changed from 1 to 0, which configures the LsSource to be LSE (needed due to errata 2.2.1). - MICROPY_HW_RFCORE_BLE_VITERBI_MODE changed from 0 to 1, which enables Viterbi mode, following all the ST examples. Signed-off-by: Damien George <damien@micropython.org>
2021-02-23rp2,stm32: Enable MICROPY_PY_UBINASCII_CRC32 to get ubinascii.crc32().Damien George
These ports already have uzlib enabled so this additional ubinascii.crc32 function only costs about 90 bytes of flash. Signed-off-by: Damien George <damien@micropython.org>
2021-02-21stm32/boards/NUCLEO_WB55: Enable LPUART1 on PA2/PA3.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-21stm32/uart: Add support for LPUART1 on L0, L4, H7 and WB MCUs.Chris Mason
Add LPUART1 as a standard UART. No low power features are supported, yet. LPUART1 is enabled as the next available UART after the standard U(S)ARTs: STM32WB: LPUART1 = UART(2) STM32L0: LPUART1 = UART(6) STM32L4: LPUART1 = UART(6) STM32H7: LPUART1 = UART(9) On all ports: LPUART1 = machine.UART('LP1') LPUART1 is enabled by defining MICROPY_HW_LPUART1_TX and MICROPY_HW_LPUART1_RX in mpconfigboard.h. Signed-off-by: Chris Mason <c.mason@inchipdesign.com.au>
2021-02-18stm32/mboot: After sig verify, only write firmware-head if latter valid.Damien George
So that mboot can be used to program encrypted/signed firmware to regions of flash that are not the main application, eg that are the filesystem. Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32/mpbtstackport: Allow chipset and secondary baudrate to be set.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32/mpbthciport: Use mp_printf instead of printf for error message.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32/mpbthciport: Fix initial baudrate to use provided value.Andrew Leech
Fixes bug introduced in the recent bffb71f523e4bcc21b913af291deeb67091bed88
2021-02-17stm32/boards: Disable onewire module on boards with small flash.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32: Make pyb, uos, utime, machine and onewire modules configurable.Damien George
The default for these is to enable them, but they can now be disabled individually by a board configuration. Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32/usb: Allow a board to configure USBD_VID and all PIDs.Damien George
If a board defines USBD_VID then that will be used instead of the default. And then the board must also define all USBD_PID_xxx values that it needs. Signed-off-by: Damien George <damien@micropython.org>
2021-02-17stm32/mboot: Add unpack-dfu command to mboot_pack_dfu.py tool.David Michieli
This command unpacks a previously packed DFU file, writing out a DFU which should be the same as the original (before packing).
2021-02-14stm32/mpbthciport: Only init the uart once, then use uart_set_baudrate.Damien George
Signed-off-by: Damien George <damien@micropython.org>
2021-02-14stm32/uart: Add uart_set_baudrate function.Damien George
This allows changing the baudrate of the UART without reinitialising it (reinitialising can lead to spurious characters sent on the TX line). Signed-off-by: Damien George <damien@micropython.org>
2021-02-04ports: Remove def of MP_PLAT_PRINT_STRN if it's the same as the default.Damien George
To simplify config, there's no need to specify MP_PLAT_PRINT_STRN if it's the same as the default definition in py/mpconfig.h. Signed-off-by: Damien George <damien@micropython.org>
2021-02-02stm32/mboot: Change debug compiler optimisation from -O0 to -Og.Andrew Leech
With mboot encrpytion and fsload enabled, the DEBUG build -O0 compiler settings result in mboot no longer fitting in the 32k sector. This commit changes this to -Og which also brings it into line with the regular stm32 build.
2021-02-02stm32/usbd_cdc_interface: Don't wait in usbd_cdc_tx_always if suspended.Damien George
MCUs with device-only USB peripherals (eg L0, WB) do not implement (at least not in the ST HAL) the HAL_PCD_DisconnectCallback event. So if a USB cable is disconnected the USB driver does not deinitialise itself (usbd_cdc_deinit is not called) and the CDC driver can stay in the USBD_CDC_CONNECT_STATE_CONNECTED state. Then if the USB was attached to the REPL, output can become very slow waiting in usbd_cdc_tx_always for 500ms for each character. The disconnect event is not implemented on these MCUs but the suspend event is. And in the situation where the USB cable is disconnected the suspend event is raised because SOF packets are no longer received. The issue of very slow output on these MCUs is fixed in this commit (really worked around) by adding a check in usbd_cdc_tx_always to see if the USB device state is suspended, and, if so, breaking out of the 500ms wait loop. This should also help all MCUs for a real USB suspend. A proper fix for MCUs with device-only USB would be to implement or somehow synthesise the HAL_PCD_DisconnectCallback event. See issue #6672. Signed-off-by: Damien George <damien@micropython.org>
2021-01-30docs,stm32: Fix minor typos in RTC docs, and->an.Andrew Scheller
2021-01-30stm32/rfcore: Fix flow control for IPCC RX IRQ.Jim Mussared
Don't clear the IPCC channel flag until we've actually handled the incoming data, or else the wireless firmware may clobber the IPCC buffer if more data arrives. This requires masking the IRQ until the data is handled. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2021-01-29stm32/main: Introduce MICROPY_HW_FLASH_MOUNT_AT_BOOT config option.Damien George
It's enabled by default to retain the existing behaviour. A board can disable this option if it manages mounting the filesystem itself, for example in frozen code. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot/fwupdate.py: Refactor update_mpy with support for STATUS.Damien George
Changes are: - refactor to use new _create_element function - support extended version of MOUNT element with block size - support STATUS element Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Introduce MBOOT_ERRNO_xxx constants and use them.Damien George
So that a failed update via fsload can be more easily diagnosed. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Add ELEM_TYPE_STATUS element so application can get status.Damien George
This new element takes the form: (ELEM_TYPE_STATUS, 4, <address>). If this element is present in the mboot command then mboot will store to the given address the result of the filesystem firmware update process. The address can for example be an RTC backup register. Signed-off-by: Damien George <damien@micropython.org>
2021-01-29stm32/mboot: Don't auto-detect littlefs block size.Damien George
Instead it is now passed in as an optional parameter to the ELEM_MOUNT element, with a compile-time configurable default. Signed-off-by: Damien George <damien@micropython.org>