flash programming problem on K20

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

flash programming problem on K20

跳至解决方案
1,350 次查看
ryanlush
Contributor IV

I'm trying to write to the FLASH on a K20 using KSDK 2.0. My issue seems to be more of a general programming error than anything else. Here is is.

 

I'm using the following function:

 

status_t FLASH_Program(flash_config_t *config, uint32_t start, uint32_t *src, uint32_t lengthInBytes)

 

My call looks like this:

 

uint8_t packet[2048]; // Data starts at index 9

result = FLASH_Program(&flashDriver, address, (uint32_t*)&packet[9], length);

 

The guts of this function where I'm having the problem is here

 

    kFCCOBx[1] = *src++;

 

I can use a hardcoded value in place of *src++ and the value makes its way into flash. I can put *src++ on another line and that works. Trying to read *src always causes a fault. I can see in the debugger it points to the data I would expect it to point to.

 

Any help?

标签 (1)
0 项奖励
回复
1 解答
1,205 次查看
ryanlush
Contributor IV

It was an unaligned uint32 access.

Thank you,

Ryan

(sent from mobile device)

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,205 次查看
DavidS
NXP Employee
NXP Employee

Hi Ryan,

Have you compared your code to our example:

C:\NXP\KSDK_v2\SDK_2.0_FRDM-KL43Z_KDS\boards\frdmkl43z\driver_examples\flash\flash_erase_program_verify\kds

Which K20 device?  50MHz? 72MHz? 100MHz? 120MHZ?

Did you erase the sector (or two) before trying to program the flash?

Regards,

David

0 项奖励
回复
1,206 次查看
ryanlush
Contributor IV

It was an unaligned uint32 access.

Thank you,

Ryan

(sent from mobile device)

0 项奖励
回复
1,205 次查看
DavidS
NXP Employee
NXP Employee

Hi Ryan,

Thank you for letting one and all know the issue,

Regards,

David

0 项奖励
回复