diff options
author | Damien George <damien@micropython.org> | 2024-06-18 17:46:21 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2025-07-08 16:24:27 +1000 |
commit | eb3ea9ee13093d81053f5d07b8c96e4fc0e1383d (patch) | |
tree | 07f7bb3e3f9c6fb1f4204c531d3c18a29c3cb189 /ports/stm32/stm32_it.c | |
parent | 24fd5f72682922664c0bcf70d6e3631a6d5b8d2b (diff) |
stm32: Add support for STM32N6xx MCUs.
This commit adds preliminary support for ST's new STM32N6xx MCUs.
Supported features of this MCU so far are:
- basic clock tree initialisation, running at 800MHz
- fully working USB
- XSPI in memory-mapped mode
- machine.Pin
- machine.UART
- RTC and deepsleep support
- SD card
- filesystem
- ROMFS
- WiFi and BLE via cyw43-driver (SDIO backend)
Note that the N6 does not have internal flash, and has some tricky boot
sequence, so using a custom bootloader (mboot) is almost a necessity.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/stm32_it.c')
-rw-r--r-- | ports/stm32/stm32_it.c | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/ports/stm32/stm32_it.c b/ports/stm32/stm32_it.c index 4bf509bb9..3639e2f04 100644 --- a/ports/stm32/stm32_it.c +++ b/ports/stm32/stm32_it.c @@ -343,14 +343,22 @@ void OTG_FS_IRQHandler(void) { } #endif #if MICROPY_HW_USB_HS +#if defined(STM32N6) +void USB1_OTG_HS_IRQHandler(void) { + IRQ_ENTER(USB1_OTG_HS_IRQn); + HAL_PCD_IRQHandler(&pcd_hs_handle); + IRQ_EXIT(USB1_OTG_HS_IRQn); +} +#else void OTG_HS_IRQHandler(void) { IRQ_ENTER(OTG_HS_IRQn); HAL_PCD_IRQHandler(&pcd_hs_handle); IRQ_EXIT(OTG_HS_IRQn); } #endif +#endif -#if MICROPY_HW_USB_FS || MICROPY_HW_USB_HS +#if (MICROPY_HW_USB_FS || MICROPY_HW_USB_HS) && !defined(STM32N6) /** * @brief This function handles USB OTG Common FS/HS Wakeup functions. * @param *pcd_handle for FS or HS @@ -421,7 +429,7 @@ void OTG_FS_WKUP_IRQHandler(void) { } #endif -#if MICROPY_HW_USB_HS +#if MICROPY_HW_USB_HS && !defined(STM32N6) /** * @brief This function handles USB OTG HS Wakeup IRQ Handler. * @param None @@ -480,7 +488,7 @@ void ETH_WKUP_IRQHandler(void) { } #endif -#if defined(STM32H5) +#if defined(STM32H5) || defined(STM32N6) void TAMP_IRQHandler(void) { IRQ_ENTER(TAMP_IRQn); Handle_EXTI_Irq(EXTI_RTC_TAMP); @@ -502,6 +510,9 @@ void TAMP_STAMP_IRQHandler(void) { #if defined(STM32H5) void RTC_IRQHandler(void) +#elif defined(STM32N6) +#define RTC_WKUP_IRQn RTC_S_IRQn +void RTC_S_IRQHandler(void) #else void RTC_WKUP_IRQHandler(void) #endif @@ -509,8 +520,8 @@ void RTC_WKUP_IRQHandler(void) IRQ_ENTER(RTC_WKUP_IRQn); #if defined(STM32G0) || defined(STM32G4) || defined(STM32WL) RTC->MISR &= ~RTC_MISR_WUTMF; // clear wakeup interrupt flag - #elif defined(STM32H5) - RTC->SCR = RTC_SCR_CWUTF; // clear wakeup interrupt flag + #elif defined(STM32H5) || defined(STM32N6) + LL_RTC_ClearFlag_WUT(RTC); #elif defined(STM32H7A3xx) || defined(STM32H7A3xxQ) || defined(STM32H7B3xx) || defined(STM32H7B3xxQ) RTC->SR &= ~RTC_SR_WUTF; // clear wakeup interrupt flag #else @@ -520,6 +531,12 @@ void RTC_WKUP_IRQHandler(void) IRQ_EXIT(RTC_WKUP_IRQn); } +#if defined(STM32N6) +void RTC_IRQHandler(void) { + RTC_S_IRQHandler(); +} +#endif + #if defined(STM32F0) || defined(STM32G0) || defined(STM32L0) #if defined(STM32G0) |