AnsweredAssumed Answered

flash programming problem on K20

Question asked by Ryan Lush on May 25, 2016
Latest reply on May 26, 2016 by David E Seymour

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?