Flash Issue in FreeRTOS Application , Unable to Read the Data from the Flash After a soft reset.

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

Flash Issue in FreeRTOS Application , Unable to Read the Data from the Flash After a soft reset.

1,254 Views
HarishCS
Contributor II
I'm encountering a problem with FLASH memory on the Qn9090 Chip in a FreeRTOS application. 
When I write data to the flash memory in one task and then use the Read API to retrieve it, the data appears valid. However, 
after a soft reset, the data becomes corrupted, showing only 'db' when I attempt to read it.
 
Hence after a Soft Reset the FLASH Data seems to be corrupted.
I initially suspected it might be related to task switching, so I disabled all interrupts and suspended all tasks to test this. The issue not fixed.
 
But  when I tried the same experiment in a standalone setup(without Freertos), the data remained valid even after a reset.
 
Write Operation:
        OSA_InterruptDisable();
         vTaskSuspendAll();
        FLASH_Init(FLASH);
        int err_code ;
        err_code = FLASH_ErasePages(FLASH, FLASH_START_PAGE, 1);
        if(err_code == kStatus_FLASH_Success)
        {
        PRINTF(" kStatus_FLASH_Success");
        }
        uint32_t au32Data[sizeof(struct generic_beacon_cota_param_t)];
        for (uint32_t i = 0; i < sizeof(struct generic_beacon_cota_param_t); i++)
        {
            au32Data[i] = 0x99;//(uint32_t)(rand());
        }
        err_code = FLASH_Program(FLASH,
    bcn_cota_params_addr,
    &au32Data,
    sizeof(struct generic_beacon_cota_param_t));
        if(err_code == kStatus_FLASH_Success)
        {
        PRINTF(" kStatus_FLASH_Success");
        }
        OSA_InterruptEnable();
        xTaskResumeAll();
 
Read Operation:
OSA_InterruptDisable();
    vTaskSuspendAll();
uint32_t temp[4];
uint32_t readData[sizeof(struct generic_beacon_cota_param_t)] = {0};
PRINTF(" Pre Process Data : ");
    for(uint32_t i = 0;i < sizeof(struct generic_beacon_cota_param_t);i += 4)
    {
    FLASH_Read(FLASH, (uint8_t *)(bcn_cota_params_addr + i), 0, (uint32_t *)temp);
    memcpy(&readData[i], (void *)temp, sizeof(temp));
    PRINTF("%02x ",readData[i]);
    }
    OSA_InterruptEnable();
    xTaskResumeAll();
 
 
 
Output :
Output: Before Soft Reset
Pre Process Data :      99 99 99 99 99 99 99 99 00 00 00 00 00
  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Output: After Soft Reset
 Pre Process Data : f601dead dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb
  dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb 
dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb dbdbdbdb
Labels (1)
Tags (2)
0 Kudos
Reply
3 Replies

1,223 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hello @HarishCS,

Hope you are doing well.

Could you please help us with more details about your application? What is its purpose?

What QN9090 SDK version are you using? Are you using any of the demo applications from the SDK as base for your development? If so, which one?

What is the flash region you are trying to write?

Regards,
Eduardo.

0 Kudos
Reply

1,187 Views
HarishCS
Contributor II

Hello @EduardoZamora 

This Application uses BLE in it, SDK Version 2.6.5 , build on top of the example wireless UART. I am trying to Write in the Flash Region "0x0009B000"

0 Kudos
Reply

1,082 Views
EduardoZamora
NXP TechSupport
NXP TechSupport

Hi,

There should be a newer version of the QN9090 SDK, you can download the latest version from the MCUXpresso SDK Builder.

Have you tested the driver_examples > flash_demo without modifications? Do you observe the same behavior described in this post? Please, compare your read/write procedure with the one from the flash_demo application.

By any chance, is gAppUseNvm_d set to 1 in app_preinclude.h file?

Also, could you try the same procedure using another demo application from the SDK without BLE functionality as base?

As another test, you could try writing to another address outside the NVM region. Please, take a look at the src > connectivity.ld file for more information on the map of QN9090 FLASH.

Please, let me know your findings.

Regards,
Eduardo.

0 Kudos
Reply