Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


How to use HAL_FLASH_Program_IT ?

How to use HAL_FLASH_Program_IT ?

I got HAL_FLASHEx_Erase() and HAL_FLASH_Program() working OK
But it is blocking code and want to avoid using it.

When I try HAL_FLASHEx_Erase_IT() the return value seems to say everything went OK,
but when I do HAL_FLASH_Program_IT() it return value suggest its busy and does not write anything.
Even if I put 100ms delays between erase and program, its still busy.

Seems like some interrupt not enabled - but not sure which interrupt needs
enabling as it escapes documentation time and time again in all the various
available documentation and forums. eek

Make sure the NVIC is configured for flash interrupts. If using CubeMX, enable NVIC Flash intterupt and expect CubeMX to generate FLASH_IRQHandler() that calls HAL_FLASH_IRQHandler() in the xxx_it.c file. A breakpoint can be used to ensure that FLASH_IRQHandler() or HAL_FLASH_IRQHandler() are bing called.

You can define a HAL_FLASH_EndOfOperationCallback to perform some operation upon completion. Or, you can look at pFlash.ProcedureOnGoing == FLASH_PROC_NONE to know the operation is complete.

Note that if the purpose of using HAL_FLASH_Program_IT is to erase flash asynchronously while running from flash, it will not work as expected. Expect execution from flash to freeze while an erase is in-progress which effectively means HAL_FLASH_Program_IT() will block until complete. If you’re executing from RAM, this blocking won’t occur.


 

Newest Forum Posts

  1. Можно ли установить камин на балконе или лоджии? by Grand3kpdErorb, 03:38
  2. reservation car service Seattle by Jamesprede, 2025-05-01 10:06
  3. Last day: drone bonus by Danielrug, 2025-04-19 16:55
  4. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  5. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  6. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  7. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  8. Insightful Perspectives on This Subject by davidsycle, 2025-03-04 05:45
  9. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05

Last-Modified Blogs