Dear all,
I'm developing an application running on an LPC55S28 CPU at 150MHz that requires writing data to the internal flash memory.
According to the datasheet, write operations might necessitate a lower clock speed. I plan to decrease the clock speed from 150MHz to 96MHz, perform the write operation, and then raise it back to 150MHz.
Could you please review this approach and provide any recommendations for the correct procedure? If possible, a working code sample demonstrating the clock switching and flash write operation would be greatly appreciated.
Thank you very much for your help and cooperation.
解決済! 解決策の投稿を見る。
dear @Alice_Yang
It works, but I have another problem.
Since this is an audio application, I can't modify the system clock. Many CPU-generated signals depend on it. Therefore, I decided to write to the flash during power-off. There's a hardware interface that detects the system supply voltage. When the voltage drops below 80 volts, the CPU stops generating hardware signals and starts writing to flash memory.
Unfortunately, the
BOARD_BootClockPLL96M()
routine, which sets the clock to 96 MHz, takes too long, causing the system to power off before flash writing completes.
Could I possibly halve the system clock using the
CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 2U, false)
routine, to set the clock under 100MHz ?
Thank you very much for your help and cooperation.
Best regards."
Hello @_Ferrari_
Yes, you are right. Decrease the clock speed from 150MHz to 96MHz, perform the write operation, and then raise it back to 150MHz. About change clock code, you can refer to clock_config..c file.
BR
Alice
Thank you for your answer.
If I understand I have to call
BOARD_BootClockPLL96M(); // to set the clock at 96MHz
writeFlashMemory(); // to write the internal flash
BOARD_BootClockPLL150M(); // to return back to 150NHz clock
Is it corretc ?
dear @Alice_Yang
It works, but I have another problem.
Since this is an audio application, I can't modify the system clock. Many CPU-generated signals depend on it. Therefore, I decided to write to the flash during power-off. There's a hardware interface that detects the system supply voltage. When the voltage drops below 80 volts, the CPU stops generating hardware signals and starts writing to flash memory.
Unfortunately, the
BOARD_BootClockPLL96M()
routine, which sets the clock to 96 MHz, takes too long, causing the system to power off before flash writing completes.
Could I possibly halve the system clock using the
CLOCK_SetClkDiv(kCLOCK_DivAhbClk, 2U, false)
routine, to set the clock under 100MHz ?
Thank you very much for your help and cooperation.
Best regards."