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.

AM2432: How to read Flash Status Register

Part Number: AM2432
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi team,

I'm developing mcu plus SDK with AM2432 and custom nor Flash.

Could you tell me how to read data from flash status register ?

Best regard,

Oyama

  • Hi,

    NOR flashes has 1-2 status registers which you can go ahead and read.

    I am writing down a detailed guide for you to understand how to go about reading status register from any NOR flash part.

    Not sure which NOR flash part you are using, but I am going to put forward an example of a NOR Flash part like S28HS512T which is present on the TI EVMs.

    The datasheet of the flash states that it has two status registers.

    Now we need to find how the transaction happens for the status registers. So we look for the transaction table and it is as follows.

    Now, let us understand in detail what the transaction table values mean.

    To read status register 1, we need to issue the command 0x05, but twice, so 0x05, 0x05. This is taken care of in the MCU PLUS SDK drivers Software implementation.

    But, 0x05 0x05 is the command issued only when operating in 1s-1s-1s mode.

    If operating in a mode like 8d-8d-8d mode, then one needs to use the read any register command, where we need to issue 0x65 0x65 to read any volatile or non-volatile register.

    From coding perspective, if let's say operating in 8d-8d-8d mode, and you want to read the status register 2 then one can write the following piece of code:

        uint8_t regData = 0x00;

        /* Reading the Status Register 2 */
        status = Flash_norOspiRegRead(config, 0x65, 0x00800001, &regData);

    NOTE:

    Status register 1 is addressed as 0x00800000

    Status register 2 is addressed as 0x00800001

    Hope this helps answer your question.

    Regards,

    Vaibhav

  • Hi Vaibhav,

    I tried to use Flash_norOspiRegRead(),

    but this function originally  declares as static, 

    and the argument 'config' is available from Flash_open() in the Auto generated file,

    so it is difficult to use Flash_norOspiRegRead() in main().

    So, do you know haw to use Flash_norOspiRegRead() in main()?

    or the another way to read flash register like using OSPI_Handle?   

    Best regard,

    Oyama

  • Hi Tomoya,

    Thanks for your patience.

    Please allow me sometime to look through this issue and get back to you.

    I tried to use Flash_norOspiRegRead(),

    but this function originally  declares as static, 

    and the argument 'config' is available from Flash_open() in the Auto generated file,

    so it is difficult to use Flash_norOspiRegRead() in main().

    So, do you know haw to use Flash_norOspiRegRead() in main()?

    I am going to run this by myself and find a workaround for this.

    Regards,

    Vaibhav

  • Hi,

    Thanks for your patience.

    A small workaround to you using the Flash_norOspiRegRead is simply heading to the file named flash_nor_ospi.c

    There you would see that the API is defined as static.

    Hence at the top of the file(flash_nor_ospi.c) please go ahead and write:


    int32_t Flash_norOspiRegRead(Flash_Config *config, uint8_t cmd, uint32_t addr, uint8_t *data);
    After this, remove the static keyword from the API call in the file flash_nor_ospi.c.
    Once done, you have rebuild libraries so head over to:
    MCU_PLUS_SDK_INSTALL_PATH > source > board and open command prompt.
    Please run the following commands:
     
    gmake -s -f makefile.am243x.r5f.ti-arm-clang PROFILE=release
    gmake -s -f makefile.am243x.r5f.ti-arm-clang PROFILE=debug
    You should be able to use this API directly in your application and build it successfully.
    Something like this should work for you:
    uint8_t regData = 0x00;
    Flash_Config *config = (Flash_Config*)gFlashHandle[CONFIG_FLASH0];
    status |= Flash_norOspiRegRead(config, 0x65, 0x00800002, &regData);
    DebugP_log("Value of Configuration Register 1: %u \r\n", regData);
    Regards,
    Vaibhav
  • Hi Vaibhav,

     

    I checked this change with AM243x-LP and CCS.

    I added  CONFIG_FLASH0 by sysconfig and added that script after drivers_open().

    But, it is not worked, I think because of no correct data in the gFlashHandle[CONFIG_FLASH0].

    How can I get the correct value of gFlashHandle[CONFIG_FLASH0]?

     

    Best regard,

    Oyama

  • drivers_open().

    Just after drivers open it will not work, you need to call this after Board_driversOpen()