AnsweredAssumed Answered

K22 FTFE 'Read Resource' Command: Where is the actual data in FCCOB?

Question asked by SCOTT THOMPSON on May 28, 2015
Latest reply on Jun 2, 2015 by SCOTT THOMPSON



I'm using FTFE flash in a MK22FX512VLL12 device and have kludged in some capabilities for FlashX support in MQX based on FTFL drivers.


From the reference manual for the MK22FX device, the Data Flash 0 IFR section should have the EEPROM and DEPART codes at the following locations:

For the Data Flash 0 IFR, our resource select code is 0x00 and the local address range is 0x80_0000–0x80_03FF.


Data in FTFE is big-endian, and the flash address must be 64-bit aligned, which means I need to read at 0x8003F8 to get the start of my block that will index into the IFR.


According to the reference manual (again), the following FCCOB registers highlight the corresponding data returned:

Using a DSTREAM ICE, the corresponding FCCOB registers that are returned from a previously partitioned device are:


The indices in command_array (above) correspond directly to the FCCOB number, so FCCOB[0] = 0x03, which is the Read Resource command.  The address is 0x8003F8, and so forth.  I am reading in the full 12-bytes from FCCOB.


Since I expect my data to be at 0x03FC, 0x03FD, and my 8-byte buffer (now in FCCOB) starts at 0x03F8, I should expect my data to be in FCCOB[6] and FCCOB[7] (right?).  Yet, looking at FCCOB[6] and FCCOB[7], above, we see that these are 0xFF bytes.  It almost appears that the actual EEPROM data size (and split) and DEPART codes are stored at FCCOB[A] and FCCOB[B].


Note: reading the SIM_FCFG1 register gives me valid results for EESIZE and DEPART, and I can start to use that to determine if the partition is created, but all of our other code relies on the Read Resource command and I'd like to understand this better anyway...


(For completeness, I've included the EESIZE and DEPART codes so it can be seen that command_array[10], command_array[11] might actually contain valid partition codes.)

My goal is for EESPLIT to be 0x3 (1/2A + 1/2B), EESIZE to be 4096 Bytes (EEPROM code = 0x32), and for the partition code to be 64 kB Data Flash and 64 kB EEPROM Backup (16x 4 kB) (DEPART = 0x4).


Thanks for any insights, Freescale Community