flash programming problem on K20

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

flash programming problem on K20

Jump to solution
591 Views
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?

Labels (1)
0 Kudos
1 Solution
446 Views
ryanlush
Contributor IV

It was an unaligned uint32 access.

Thank you,

Ryan

(sent from mobile device)

View solution in original post

0 Kudos
3 Replies
446 Views
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 Kudos
447 Views
ryanlush
Contributor IV

It was an unaligned uint32 access.

Thank you,

Ryan

(sent from mobile device)

0 Kudos
446 Views
DavidS
NXP Employee
NXP Employee

Hi Ryan,

Thank you for letting one and all know the issue,

Regards,

David

0 Kudos