AM2432: Data read from custom OSPI flash from application code is shifted by one byte compared to the same code used in sbl.

Part Number: AM2432
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG

Hi,

we are using AM243x with a custom flash. We already created a custom flasher_jtag_uniflash project for  programming the flash with uniflash tool and a custom sbl to copy the application from the custom flash to RAM. This works already pretty well. Also writing to flash in sbl is ok. We plan to use XIP in future so we activated DAC mode in sbl and in application as well. I now have the phenomenon that reading the flash content by the memory view in CSS20 is different in sbl and application. In application the content is shifted by one byte. Refer the attached pictures.

SBL:

AM243x_sbl.png

APPL:

AM243x_appl.png

Not only the memory view shows this, but also my code reads these values from the flash. As far as I can see the settings in sysconfig are the same for flash/OSPI in sbl and application. I use mcu_plus_sdk_am243x_12_00_00_26 for both, sbl and application. Memory view in sbl fits to memory view in uniflash tool. 

Any idea what I'm doing wrong?

  • Memory view in sbl fits to memory view in uniflash tool. 

    Sorry. I'm no longer sure about this one:

  • Hi Peta,

    Can you share the SysConfig files for the SBL and the Application?

    Can you also share the name of the custom Flash part being used?

    Regards,

    Aryamaan

  • Hi Aryamaan,

    Thank you for your response. Please find the requested files attached. The flash part is a GigaDevice GD25Q64E.8463.syscfg.zip

  • Thank you for sharing the files. The OSPI and Flash configurations are the same in the SBL and in the Application side, so this does not seem to be an OSPI or Flash configuration issue in SysConfig.

    Can you please try out the following?

    After performing the read operation in both the SBL side and Application side, can you verify whether the contents of the OSPI registers are the same in the SBL and the Application?

    The OSPI registers are found at the address: 0xFC40000h to 0xFC400FCh.

    For example, the values of the OSPI registers in CCS memory browser would look like this:

    The values of these registers would be different in your case.

    Regards,

    Aryamaan

  • Hi Arymaan,

    I found the reason why the application shows different flash reading results:
    In the application Flash_norOspiOpen() fails because the bootQuirksFxn does not return 0.
    This is because I copied the flashFixUpQspiBoot() from an sdk11 example sbl_ospi and in this example the function has this signature:
    void flashFixUpQspiBoot(void);
    Please notice the return type void!
    In sbl this function returns 0 (randomly) and in my application I had to modify the code and here it does not return 0.
    Making a long story short: If I use the correct return type and return 0 in the quirks function, my application behaves as expected.
    Thank you for your help.

    Best regards
    Peta

  • Hi Peta,

    Boot Quirks functions like flashFixUpQspiBoot and Flash_quirkOSPIEarlyFixup are primarily designed to work with the default Flash parts mounted on the AM243x EVM. For custom Flash parts, these functions would have to be set to NULL or be modified based on the custom Flash configuration.

    Im glad your issue has been resolved!

    Regards,

    Aryamaan