Question
Main clock + Simulation EEPROM
Posted on November 04, 2015 at 08:38
Hi,
I just started to pickup programming STM32F0308-DISCO based onSTM32F030R8T6.
I have configurated the clocks and got the timers working on the desired 48 MHz. But when I try to simulate a delay with a for loop in the main function I noticed that the clock speed is less than 48 MHz with the code:uint32_t i =0;for(i = 0; i < 48000000; i++) It gives a delay of around 15 seconds. I thought SYSCLK is the speed of the main function, which I configurated on 48 MHz. Am I getting this wrong?Next question is about the simulation of EEPROM memory in the flash registers. TheSTM32F030R8T6 uses 64 kbytes flash on registers 0x0800 0000 - 0x0800 FFFF. When I write on page 63, starting on 0x0800 FC00, everything works. It writes the flash register and when I read it I get the desired value. But when I program it again, the system keeps getting stuck when erasing the page.
FLASH_SetLatency(FLASH_Latency_1); FLASH_PrefetchBufferCmd(ENABLE); FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPERR); FLASHStatus = FLASH_ErasePage((uint32_t)0x0800FC00); FLASHStatus = FLASH_ProgramWord((uint32_t)0x0800FC00, 0x12345678); FLASH_Lock();Looking forward to your comments.Regards