LPC55S28 Internal Flash Write Operation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LPC55S28 Internal Flash Write Operation

跳至解决方案
1,866 次查看
_Ferrari_
Contributor V

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.

 

 

0 项奖励
回复
1 解答
1,710 次查看
_Ferrari_
Contributor V

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."

 

在原帖中查看解决方案

标记 (1)
0 项奖励
回复
4 回复数
1,848 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

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

0 项奖励
回复
1,816 次查看
_Ferrari_
Contributor V

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 ?

 

0 项奖励
回复
1,808 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @_Ferrari_ 

Yes.

 

BR

Alice

0 项奖励
回复
1,711 次查看
_Ferrari_
Contributor V

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."

 

标记 (1)
0 项奖励
回复