Wykres commitów

26 Commity (master)

Autor SHA1 Wiadomość Data
Rene Straub 47ea831c0e stm32: Add STM32H5 support for sleep mode.
Update rtc, machine and powerctrl drivers to support STM32H5 sleep
modes. This makes RTC alarm wakeup working from lightsleep() and
deepsleep().

Changes:
- Determine start reason for machine.reset_cause() in modmachine.c.
- Add proper interrupt clear code in rtc.c.
- Add wakeup functionality in powerctrl_enter_stop_mode(). Remember
  and restore voltage scaling level. Restart HSI48 if it was on before
  entering sleep mode.
- Clear DBGMCU_CR in SystemClock_Config() as for other variants.
  Otherwise debug flags prevent entering sleep mode.

Implementation Notes:
- rtc.c: EXTI_RTSTR1 bits are not present for H5. Code sequence from
  G0/G4/L4/WB/WL would be invalid. RTSTR is only defined for external
  (GPIO) interrupts. Maybe this is also true for other STM32 variants.
- powerctrl_enter_stop_mode() uses complicated, nested conditionals
  to select STM32 variants. To make code slightly better readable,
  comment have been added. A non-nested, #if/#elif sequence would
  make the code more readable. I leave this to the original authors.

Signed-off-by: Rene Straub <rene@see5.ch>
2023-11-03 17:14:05 +11:00
Damien George a3862e7267 stm32/powerctrlboot: Allow PLL1 Q and R outputs to be enabled on H5.
If a board needs these outputs then it can define MICROPY_HW_CLK_PLLQ/R.

It saves power to not enable them if they are not needed.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-20 18:56:52 +10:00
Damien George 67b1c81f69 stm32/powerctrlboot: Allow using PLL3 for USB clock on H5 MCU's.
A board should enable MICROPY_HW_CLK_USE_PLL3_FOR_USB to use this feature.

Signed-off-by: Damien George <damien@micropython.org>
2023-09-13 16:48:15 +10:00
Angus Gratton 2c62adb42c stm32/powerctrlboot: Support STM32WL system clock from HSE+PLL.
Switches default on the NUCLEO_WL55 board to use the HSE oscillator powered
from PB0_VDDTCXO pin.

Build-time configuration can select from MSI internal oscillator (previous
default), HSE via crystal, or HSE bypass with TCXO powered from PB0_VDDTCXO
pin (new default)

Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-08-23 11:58:11 +10:00
Yuuki NAGAO a2c02014cd stm32: Modify RCC->APB2ENR directly instead of HAL API.
Also, it is needed only when USB is enabled.

Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
2023-06-27 22:28:31 +09:00
Yuuki NAGAO 7ca3c1d892 stm32: Add USB support for STM32L1 MCUs.
Signed-off-by: Yuuki NAGAO <wf.yn386@gmail.com>
2023-06-27 22:28:31 +09:00
Damien George 61339aa506 stm32: Add initial support for H5 MCUs.
This commit adds initial support for STM32H5xx MCUs.  The following
features have been confirmed to be working on an STM32H573:
- UART over REPL and USB CDC
- USB CDC and MSC
- internal flash filesystem
- machine.Pin
- machine.SPI transfers with DMA
- machine.ADC
- machine.RTC
- pyb.LED
- pyb.Switch
- pyb.rng
- mboot

Signed-off-by: Damien George <damien@micropython.org>
2023-06-15 11:09:20 +10:00
Damien George c7923b1139 stm32: Add support for USB on G0 MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2023-03-22 16:38:03 +11:00
Damien George 8b3f1d47a6 stm32/powerctrlboot: Provide custom SystemInit for WB55.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
Signed-off-by: Damien George <damien@micropython.org>
2023-03-08 14:04:14 +11:00
Andrew Leech 2eca86e8fa stm32/powerctrl: Add sleep RCC semaphore management for WB55 MCUs.
Signed-off-by: Andrew Leech <andrew.leech@planetinnovation.com.au>
2023-03-08 11:33:00 +11:00
yn386 427d72667f stm32: Add support for STM32L1 MCUs.
This change adds STM32L1 support to the STM32 port.
2022-09-25 23:56:41 +10:00
Asensio Lorenzo Sempere 010012c7c3 stm32: Add support for G0 MCUs.
This commit adds support for the STM32G0 series of MCUs.

Signed-off-by: Asensio Lorenzo Sempere <asensio.aerospace@gmail.com>
2022-04-28 11:56:15 +10:00
Damien George e0a0719416 stm32: Add initial support for STM32WL MCUs.
Signed-off-by: Damien George <damien@micropython.org>
2022-02-04 09:43:43 +11:00
Damien George 4a4f269a1a stm32/powerctrlboot: Set HAL uwTickPrio variable when needed.
Signed-off-by: Damien George <damien@micropython.org>
2022-01-31 18:26:55 +11:00
Damien George f834fef6bb stm32/powerctrl: Support changing frequency on WB MCUs.
This allows changing the frequency to: 100kHz, 200kHz, 400kHz, 800kHz,
1MHz, 2MHz, 4MHz, 8MHz, 16MHz, 32MHz, 64MHz.  For frequencies 2MHz and
below, low power run (LPR) mode is enabled automatically.

Signed-off-by: Damien George <damien@micropython.org>
2021-08-07 23:41:20 +10:00
Jim Mussared 0f28020a68 stm32/powerctrlboot: Acquire HSEM5 on STM32WB during SystemClock_Config.
This is required to allow using WS firmware newer than 1.1.1 concurrently
with USB (e.g. USB VCP).  It prevents CPU2 from modifying the CLK48 config
on boot.

Tested on WS=1.8 FUS=1.1.

See AN5289 and https://github.com/micropython/micropython/issues/6316
2020-09-08 23:53:12 +10:00
Damien George ce326699d7 stm32/powerctrlboot: Include irq.h to get definitions of IRQ priorities.
irq.h is included by py/mphal.h but it's better to be explicit, eg if mboot
uses powerctrlboot.c.

Signed-off-by: Damien George <damien@micropython.org>
2020-06-22 13:47:48 +10:00
Damien George 69661f3343 all: Reformat C and Python source code with tools/codeformat.py.
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28 10:33:03 +11:00
Damien George 12413e92a3 stm32/powerctrlboot: Fix config of systick IRQ priority on F0/L0/WB MCU.
Prior to this commit the systick IRQ priority was set at lowest priority on
F0/L0/WB MCUs, because it was left at the default and never configured.
This commit ensures the priority is configured and sets it to the highest
priority.
2019-10-21 12:23:41 +11:00
Chris Mason eb12fa3862 stm32/powerctrlboot: Add support for HSI at 8MHz on F0 MCUs.
For use with F0 MCUs that don't have HSI48.  Select the clock source
explicitly in mpconfigboard.h.

On the NUCLEO_F091RC board use HSE bypass when HSE is chosen because the
NUCLEO clock source is STLINK not a crystal.
2019-09-26 17:34:04 +10:00
Chris Mason f16e4be3fa stm32/powerctrlboot: Fix clock and PLL selection for HSI48 on F0 MCUs.
Before this patch the UART baudrate on F0 MCUs was wrong because the
stm32lib SystemCoreClockUpdate sets SystemCoreClock to 8MHz instead of
48MHz if HSI48 is routed directly to SYSCLK.

The workaround is to use HSI48 -> PREDIV (/2) -> PLL (*2) -> SYSCLK.

Fixes issue #5049.
2019-09-26 17:32:22 +10:00
Damien George 59b7166d87 stm32: Add initial support for STM32WBxx MCUs.
This new series of MCUs is similar to the L4 series with an additional
Cortex-M0 coprocessor.  The firmware for the wireless stack must be managed
separately and MicroPython does not currently interface to it.  Supported
features so far include: RTC, UART, USB, internal flash filesystem.
2019-07-17 16:33:31 +10:00
Damien George 4096fa397b stm32/powerctrlboot: Increase SYSCLK to 32MHz for L0 MCUs. 2019-07-16 14:46:31 +10:00
Damien George 4c1ad1f691 stm32: Add support for USB on L0 MCUs. 2019-07-16 14:45:53 +10:00
Damien George c15dc2c4b9 stm32/powerctrl: Move F0's SystemClock_Config to powerctrlboot.c. 2019-07-08 15:23:53 +10:00
Damien George 21ecf8be5f stm32/powerctrl: Move L0's SystemClock_Config to powerctrlboot.c file. 2019-07-08 15:23:53 +10:00