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.

MCU-PLUS-SDK-AM243X: Flash API write to a sector

Part Number: MCU-PLUS-SDK-AM243X

Hi,

I want to use the flash api to erase and write to flash sectors. I tried out with the sdk ospi_flash_io example. It seems like I must first erase a block using Flash_eraseBlk  to be able to write to a sector. I tried running the example without erasing the block and Flash_write returned failure flag as a certain timeout occured. Is there any explanatrion for this behaviour?

Thanks in advance.

Best

Belal

  • Hi belal,

    Please expect a delay in the response due to weekend. The subject matter expert will reply soon.

    Thanks

  • Hi ,

    I tried the following changes for me and this worked. I made sure that the Flash Sector was already in Erased state manually.

    /cfs-file/__key/communityserver-discussions-components-files/908/flashWriteDiff.patch

    I must first erase a block using Flash_eraseBlk  to be able to write to a sector.

    Yes, the flash must always be in erased state before you attempt to program the sector. If that is not the case, then the flash writes are suppose to fail.

    In my case, I manually made sure the flash sector was in erased state (all 0xFFs) and then attempted to program the sector.

    Best Regards,
    Aakash

  • Hi Aakash,

    so you were able to write to a sector after erasing it and without erasing the full block? weird because it didn't work for me.

    I suppose we do not have to erase the whole block to write to a sector and erasing that sector beforehand should be sufficient.

    Best

    Belal

  • Hi Belal,

    As per the flash documentation, there are options to configure Block as 256KB and Sectors as 4KB and in our case, we have enabled the uniform sector only. So the Flash Block Erase is the optimum option to use here.

    If you intend to use the Sector Erase for 4KB. You need to enable the Hybrid mode by changing the function mentioned here -

    And based on the configuration, you need to erase the 4KB Sectors.

    Hope this helps.

    Best Regards,
    Aakash