This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: Can't write data to flash multiple times by NVM_APP_writeAsync()

Part Number: LP-AM243


Tool/software:

Hi Team,

I'm developing application for LP-AM243x using "ethercat_slave_demo" of 401_simple in the SDK ver.09_02_00_15.

I'd like to copy two or more data to Flash, one after the other. The size of one data is about 5k byte.

Below is a simplified process to data copy to Flash.

First, I used NVM_APP_writeAsync() to copy Data Buffer1

Second, I also used NVM_APP_writeAsync()  to copy Data Buffer2, after returned NVM_ERR_SUCCESS from EC_SLV_APP_FoE_fileWriteCb().

However, It failed to copy data second time, and returned NVM_ERR_FAIL  from EC_SLV_APP_FoE_fileWriteCb().

Data Buffer1 and Data Bufferwere not changed while this process.

What do you think that the cause not to copy data at second time?

Best regards,

Oyama

  • Hello Oyama,

    When writing data to the flash, always make sure that the offset is page aligned.

    uint32_t NVM_APP_writeAsync(
        const NVM_type_t type,
        const uint32_t id,
        const uint32_t offset,
        const uint32_t length,
        const void * const pData)
    This could be the reason for the failure in your case. As a work around, you could try to write the complete data to the flash in one iteration using NVM_APP_writeAsync().
    In the current NVM driver implementation, the API NVM_DRV_FLASH_write() erases the corresponding block every time it is called. This leads to data loss when consecutive data chunks are written to the same block in the flash using this API.
    In the upcoming EtherCAT SDK release, there will be an update to the APIs NVM_APP_writeAsync()NVM_APP_write() and NVM_DRV_FLASH_write(), to enable user to decide if the block erase is required or not in a write cycle.

    Kind Regards,