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.

RTOS/AM5728: QSPI flash erase

Part Number: AM5728


Tool/software: TI-RTOS

Hi,

I am using IDK-Am5728 board and referring to qspi_diag.c under diag folder in context of no-os environment.

In diag_qpsi.c found out below api for erasing the block

 S25FLFlash_BlockErase(flashHandle, blockNumber);

But how to erase the flash at particular offset ? Suppose I need to erase the flash at 0x40000 and 0x1E0000.
Do I need to convert the offset in block number or there exist an api which will do the same.

BR,Abhinav

  • The RTOS team have been notified. They will respond here.
  • Abhinav,

    We have implemented the erase function using an API in board library called Board_eraseBlk. I recommend that you refer to the bare-metal QSPI flash writer that is found at the following location inside the boot/SBL folder.

    :<PDK_INSTALL_PATH>\packages\ti\boot\sbl\tools\flashWriter\qspi\src\ sbl_qspi_writer.c

    <PDK_INSTALL_PATH>\packages\ti\boot\sbl\soc\am57xx\sbl_soc.c

    Notice the there is a call to SBL_qspiFlashWrite in the code sbl_qspi_writer.c. As per the QSPI flash spec, it is mandatory to erase the block before programming it so in the function SBL_qspiFlashWrite, we read the offset and convert it to blockNum and erase the blocks before programming them. We don`t have a specific function defined for erase but you can cipy the the SBL_qspiWrite function and create a SBL_qspiErase function nby eliminating the code that programs the blocks after erase.

    Hope this helps.

    Regards,

    Rahul

  • Abhinav,

    Steps to utilize the QSPI flash writer on the eAM57xx IDK is described  here:

    I have updated the SBL Flash writer to add the erase option for your reference.  Please refer to the following package:

    sbl_update.zip

    The files provided in the package are from the following location inside the PDK package.

    PDK_INSTALL_PATH/packages/ti/boot/sbl/soc/am57xx/sbl_soc.c
    PDK_INSTALL_PATH/packages/ti/boot/sbl/soc/sbl_soc.h
    PDK_INSTALL_PATH/packages/ti/boot/tools/flashWriter/qspi/src/sbl_qspi_writer.c

    Steps to Erase:

    1. Fat format a SD card and copy the erase_config on the card.

    2. Connect to A15 core on the IDK and load and run the .out in the package.

    The flash writer reads the erase configuration from the erase_config and erases the QSPI flash at specified offset and  specified size of the erase operation.

    Let me know if you have any issues bring this up.

    Regards,

    Rahul

  • Hi Rahul,

    I will go through the shared package and the required files.

    But to set a correct context and my requirement is that I have to erase the flash at particular offset from the qspi_diag.c.
    As we have modified this file a/c to our purpose and we are writing the MLO, u-boot and kernel file through this utility code to the flash in bare-metal scenario.
    Basically we are loading this binary from JTAG to idk board. There is no SD card in the scenario.

    Now as you also mentioned that before writing something to the flash we have to first erase that sector. The same thing we want to achieve.

    I think this may clear our aim.

    Can you now tell me with above reference what will be helpful. Whether your above posts are aligned with my context ?


    BR,Abhinav


  • Abhinav,

    QSPI diag is just a functional test aimed to validate the interface with QSPI flash on the board. It is not designed to be a flash writer utility. You can choose to use that as a starting point but I recommended using QSPI flash writer as it is also bare-metal and  has been tested from flashing  and boot perspective.

    Only effort required with the flash writer is to remove the file IO read from SD card and replace it with a mechanism to read the input file from a different interface.

    Regards,

    Rahul

  • Hi Rahul,

    Sorry for late reply.

    The issue is resolved as I got the conversion details from the sbl_soc.c.
    The same implementation ported for the qpsi_diag.c and its working.

    On your concern of using qspi_diag.c instead of sbl_qspi_writer.c, wanted to know the difference between them, checked the qspi_read and qpsi_write api's and found out internally both are using the same api's. If this is the case then both are almost the same according to me.

    BR,Abhinav