Showing results for 
Search instead for 
Did you mean: 

STM32 HAL flash interrupts

Associate II

I'm working with the STM32L152. I'm finding that after my code runs for some time, during a write attempt to the EEPROM, 

the flash controller status register shows the WRPERR and SIZERR bits set, which causes the write to be aborted. This is happening 

somewhere before the write is attempted.

I'd like to use the error interrupt to find out where the bits are being set. However, the only HAL function I see that uses interrupts

is HAL_FLASH_Program_IT(). Our code is using HAL_FLASHEx_DATAEEPROM_Program(), which calls functions that do not have interrupt based equivalents 

(FLASH_DATAEEPROM_ProgramWord(), _ProgramByte(), etc).

Are there any equivalent functions that use the flash interrupts I can use to find the source of the errors. Thanks.


Senior III

what is your IDE?

modern IDEs have a feature usually named "data breakpoints" in contrast with "line breakpoint". A line breakpoint hits when the MCU arrives at the specified line. A databreak point hits when a specific memory location accessed (read/write). you can put data breakpoints on registers containing Interrupt Enable bits. when a function tries to enable or disable interrupt, the breakpoint hits and you can see the part of code that tries to access the register. It is an advanced debugging feature so make sure you do this properly.

Associate II

I'm working with TrueStudio. I've already found a solution for the original question I asked, but I've never looked for data breakpoints in TrueStudio. Any idea if that feature exists here? I'll look around and see if I can find it.

In truestudio it is called "watchpoint"