Hello all,
I am trying to use the Flashx driver in MQx v4.2.0.2 to store a small amount of data at the end of my flash. I was able to configure the flashx driver using this MQX Flashx driver tutorial/document. The combination of that and the flashx example I was able to get the flash to program a random 32 character sting, cycle power and read it back. This worked 2 or 3 times, then I started to move the code from the example into my application. Then the flashx driver couldn't write to the flash, I can read fine, but I cant program. I followed the traceback and I found that the error is being triggered in the flash_ftfe.c file. When the program sends the command to the flash controller it always returns with FTFE_ERR_ACCERR. I have already checked the flash_config at address 0x0400 using the code below and all the protection bits (FPROT0-FPROT3) are all set to 1. It does not matter what command I send to the controller I always get back a response with the ACCERR bit set.
debug_printf("Backdoor: 0x%X%X\r\n", *((uint32_t*)0x0400), *((uint32_t*)0x0404));
debug_printf("Protection: 0x%X \r\n", *((uint32_t*)0x0408));
debug_printf("Flash Security: 0x%X \r\n", *((uint8_t*)0x040C));
debug_printf("Flash NV Opt: 0x%X \r\n", *((uint8_t*)0x040D));
debug_printf("EEPROM prot: 0x%X \r\n", *((uint8_t*)0x040E));
debug_printf("DataFlash prot: 0x%X \r\n\n", *((uint8_t*)0x040F));
I don't think there is a protection issue because I can write new programs to the flash. I am trying to write data to address 0x1FF000 which should be the last sector (4KB sectors) in block 3 (4 blocks 512 KB each) of the flash (non FlexNVM part). Also I am able to build an S19 file, and add the line "S2081FF0005A5A5A5A80" to the file and when I read the data using the io driver or by type casting I can see the data.
I thought maybe there was a problem with the program I was using so I created a third project using KSDK 1.3 and an example for that fsl_flash component, I didn't trace into that program but it too cannot write to the flash.
Is there something I am missing?? Did I break the flash controller in my development kit?
Thank you in advance for the help!
-CoryF
Solved! Go to Solution.
I just wanted to post an update. I found the issue, I was working in a repository and someone had changed the MQX_ENABLE_HSRUN flag in the user_config.h file. As a result I could not access the flash controller. The MQX_ENABLE_HSRUN flag must be set to 0 inorder to use the FlashX driver.
Hope this can help someone in the future. :smileyhappy:
Thanks,
-CoryF
I just wanted to post an update. I found the issue, I was working in a repository and someone had changed the MQX_ENABLE_HSRUN flag in the user_config.h file. As a result I could not access the flash controller. The MQX_ENABLE_HSRUN flag must be set to 0 inorder to use the FlashX driver.
Hope this can help someone in the future. :smileyhappy:
Thanks,
-CoryF