Cy_Flash_WriteRow returns success but does not work

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
ThWi_3938146
Level 1
Level 1

I am trying to write data to the EEPROM flash rows using the PSOC6 BLE PIONEER KIT.

Here is my code running on CM0+. It completes with Success. However, the flash row is not updated when viewing memory with the debugger.

uint32_t board_flash_rows[8][128]  __attribute__((section(".cy_em_eeprom"),aligned(512)));

int main(int argc, char** argv) {

  Cy_SysDisableCM4();

  __enable_irq();

  {

    static uint32_t data[128] = {0};

    std::fill_n(data,128,0xDEADBEEF);

    int rc = Cy_Flash_WriteRow(reinterpret_cast<uint32_t>(board_flash_rows),data);

    while(rc != 0) {}

  }

  for(;;) {__WFI();}

  return 0;

}

Thoughts?

Thanks.

0 Likes
1 Solution

I just tried below C code snippet on my P6 platform in PSoC Creator, and flash write succeeds. PDL3.1.0 is selected.

Maybe it's helpful to you -

CY_SECTION(".cy_em_eeprom") CY_ALIGN(CY_FLASH_SIZEOF_ROW) uint32_t board_flash_rows[128];

int main(void)

{

    Cy_SysDisableCM4();

     __enable_irq();

    uint32_t data[128];

    for(uint8 i=0; i<128; i++)  {data = i;}

     int rc = Cy_Flash_WriteRow((uint32)board_flash_rows, (const uint32_t*)data);

    while(rc != 0) {}

    for(;;) {__WFI();}

    return 0;

}

View solution in original post

0 Likes
4 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

There are specified APIs provided in PDL to EEPROM operation. If you use PSoC Creator, the APIs would be generated autoatically under PDL folder if you have invloved EEPROM component in your design.

You can try the one Cy_Em_EEPROM_Write() instead and then check the write result.

0 Likes

Thanks for your reply.

I can test the EEPROM library. But It is not my intention to use it.

I would like some more insight into why the Flash API call returns success but does not write to the flash row.

Are there any ways I can get more information about my issue? For example breakpoints in ROM code?

Thanks.

0 Likes

I just tried below C code snippet on my P6 platform in PSoC Creator, and flash write succeeds. PDL3.1.0 is selected.

Maybe it's helpful to you -

CY_SECTION(".cy_em_eeprom") CY_ALIGN(CY_FLASH_SIZEOF_ROW) uint32_t board_flash_rows[128];

int main(void)

{

    Cy_SysDisableCM4();

     __enable_irq();

    uint32_t data[128];

    for(uint8 i=0; i<128; i++)  {data = i;}

     int rc = Cy_Flash_WriteRow((uint32)board_flash_rows, (const uint32_t*)data);

    while(rc != 0) {}

    for(;;) {__WFI();}

    return 0;

}

0 Likes

Thanks, WangS_81.

Your reply was useful in establishing a baseline.

I was using the SEGGER Ozone debugger.

It looks like I found a bug in Ozone when viewing memory after it writes to flash.

I have filed a bug report with SEGGER about this issue.

Thanks

0 Likes