2017-06-11 08:23 PM
Hi,
I am not sure if I am posting too many queries, but I guess I have no choice but to ask for help in this forum.
I am using in internal EEPROM of STM32L151 controller. I have also enabled some interrupts (external interrupt and timer interrupt). I am driving a thyristor using zero cross interrupt and a timer to control light intensity of a bulb. Everything works normally, till I try and save some data in the internal EEPROM. The size of the data is about 26 bytes.I am using the following functions, which are part of the STM library.
1. HAL_FLASHEx_DATAEEPROM_Erase (TYPEERASEDATA_BYTE,address);
2. HAL_FLASHEx_DATAEEPROM_Program (FLASH_TYPEPROGRAMDATA_FASTBYTE,address,*ptr);
The bulb flickers when I write data to EEPROM. This means, generic and/or timer interrupts are being ignored while data is being written to EEPROM. I tried to see the functions but I did not find anything related to interrupts as far as I could see. These functions depend on Systick, which is again an interrupt, but I think this interrupt is non-maskable and occurs. Can someone confirm if interrupts are being ignored during write/erase cycles? If so is there a way out? There is no provision for external EEPROM on the board and I have run out of time. Any help will be highly appreciated. Thanks.
2017-06-11 08:43 PM
From the RM on programming EEPROM:
This function can be executed from any memory. If it is from the same bank the program is stalled for one Tprog.
Maximum Tprog is 3.94msec. Make sure you write to EEPROM in the bank not used for code, or run from SRAM. The ST core stalls waiting for the flash bank to become available after the EEPROM write finishes. At 3-4 msec you are often long past the zero cross event. If you only have one bank, or code spans both flash banks, you will have to move your code to SRAM.
Jack Peacock
2017-06-11 11:06 PM
Hi Jack,
Thank you for your reply. My code is in flash, I am not running any functions from RAM and only 26 bytes of EEPROM starting from 0x08080000 is being used. I believe code (flash) and EEPROM banks are different. Am I right sir? I await your comments.
Best regards