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.

AM2434: Custom flash driver for AM2434 error

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

Hello,

I have encountered problem when trying to create custom flash driver using this guide:

AM243x MCU+ SDK: Writing flash driver for a custom flash device

STEP 1:

The AM2434 is using the IS25PL080D flash memory. I have run the ospi_flash_diag example and gotten this information:

[OSPI Flash Diagnostic Test] Starting 
[OSPI Flash Diagnostic Test] Flash Manufacturer ID : 0x9D
[OSPI Flash Diagnostic Test] Flash Device ID : 0x6014
[OSPI Flash Diagnostic Test] Executing Flash Erase on first block...
[OSPI Flash Diagnostic Test] Done !!!
[OSPI Flash Diagnostic Test] Performing Write-Read Test...
[OSPI Flash Diagnostic Test] Write-Read Test Passed!
[OSPI Flash Diagnostic Test] SFDP Information :
================================================
SFDP
================================================
SFDP Major Revision : 0x1
SFDP Minor Revision : 0x6
Number of Parameter Headers in this Table : 1

Types of Additional Parameter Tables in this flash
---------------------------------------------------

Flash_NorXspiDevDefines gFlashNorXspiDeviceDefines_<part-number> = {

.XSPI_NOR_CMD_RSTEN = 0x66,
.XSPI_NOR_CMD_RSTMEM = 0x99,
.XSPI_NOR_CMD_WREN = 0x06,
.XSPI_NOR_CMD_WRREG = 0x00,
.XSPI_NOR_CMD_BULK_ERASE = 0xC7,
.XSPI_NOR_CMD_SECTOR_ERASE_3B = 0x20,
.XSPI_NOR_CMD_SECTOR_ERASE_4B = 0x20,
.XSPI_NOR_CMD_BLOCK_ERASE_3B = 0xD8,
.XSPI_NOR_CMD_BLOCK_ERASE_4B = 0xD8,
.XSPI_NOR_CMD_PAGE_PROG_3B = 0x02,
.XSPI_NOR_CMD_PAGE_PROG_4B = 0x00,
.XSPI_NOR_CMD_RDSR = 0x05,
.XSPI_NOR_CMD_RDREG = 0x00,
.XSPI_NOR_CMD_RDID = 0x9F,
.XSPI_NOR_CMD_READ = 0x03,
.XSPI_NOR_CMD_888_SDR_READ = 0x00,
.XSPI_NOR_CMD_888_DDR_READ = 0x00,
.XSPI_NOR_CMD_444_SDR_READ = 0xEB,
.XSPI_NOR_CMD_444_DDR_READ = 0x00,
.XSPI_NOR_CMD_114_READ = 0x6B,
.XSPI_NOR_SR_WIP = 0,
.XSPI_NOR_SR_WEL = 0,
.XSPI_NOR_RDID_NUM_BYTES = 5,
.XSPI_NOR_MANF_ID = 0x9D,
.XSPI_NOR_DEVICE_ID = 0x6014,
.XSPI_NOR_114_READ_MODE_CLKS = 0,
.XSPI_NOR_114_READ_DUMMY_CYCLES = 8,
.XSPI_NOR_444_READ_MODE_CLKS = 2,
.XSPI_NOR_444_READ_DUMMY_CYCLES = 4,
.XSPI_NOR_444_READ_DUMMY_CYCLES_LC = 0x00,
.XSPI_NOR_QUAD_CMD_READ_DUMMY_CYCLES = 0x00,
.XSPI_NOR_OCTAL_READ_DUMMY_CYCLE = 0,
.XSPI_NOR_OCTAL_READ_DUMMY_CYCLE_LC = 0x00,
.XSPI_NOR_OCTAL_DDR_RDSR_DUMMY_CYCLE = 0,
.XSPI_NOR_OCTAL_DDR_RDREG_ADDR_BYTES = 0,
.XSPI_NOR_OCTAL_DDR_WRREG_ADDR_BYTES = 0,
.XSPI_NOR_OCTAL_DDR_RDVREG_DUMMY_CYCLE = 0,
.XSPI_NOR_OCTAL_DDR_RDNVREG_DUMMY_CYCLE = 0,
.XSPI_NOR_OCTAL_RDSFDP_DUMMY_CYCLE = 0,
.XSPI_NOR_OCTAL_RDSFDP_ADDR_TYPE = 0,
.XSPI_NOR_WRR_WRITE_TIMEOUT = 2000,
.XSPI_NOR_BULK_ERASE_TIMEOUT = 2048000,
.XSPI_NOR_PAGE_PROG_TIMEOUT = 200,
.XSPI_NOR_VREG_OFFSET = 0x0,
.XSPI_NOR_NVREG_OFFSET = 0x0,
.XSPI_NOR_QUAD_MODE_CFG_ADDR = 0x0,
.XSPI_NOR_QUAD_MODE_CFG_BIT_LOCATION = 0x0,
.XSPI_NOR_DDR_OCTAL_MODE_CFG_ADDR = 0x0,
.XSPI_NOR_DDR_OCTAL_MODE_CFG_BIT_LOCATION = 0x0,
.XSPI_NOR_DUMMY_CYCLE_CFG_ADDR = 0x0,
.XSPI_NOR_FLASH_SIZE = 1048576,
.XSPI_NOR_PAGE_SIZE = 256,
.XSPI_NOR_BLOCK_SIZE = 65536,
.XSPI_NOR_SECTOR_SIZE = 4096,
.addrByteSupport = 0,
.dtrSupport = 0,
.qeType = 2,
.seq444Enable = { 0, 0, 1, 0, 0 },
.seq444Disable = { 0, 1, 0, 1 },
.oeType = 0,
.cmdExtType = 0,
.byteOrder = 0,
};

STEP 2:

Following the guide in step 2. I have copied the flash_nor_ospi_quad_device_S25HL512T.c file modified it and renamed it to flash_nor_ospi_quad_device_IS25PL080D.c and added to flash_nor_ospi_quad.h  :

extern Flash_NorQspiDevDefines gFlashNorQspiDeviceDefines_IS25PL080D;
extern Flash_Attrs gFlashNorQspiAttrs_IS25PL080D;

 And made changes to makefile and flash JS file to include these changes.

After completing the steps and building the example project ospi_flash_io I have recieved this error:

undefined first referenced
symbol in file
--------- ----------------
gFlashNorQspiAttrs_IS25PL080D ./syscfg/ti_board_open_close.o
gFlashNorQspiDeviceDefines_IS25PL080D ./syscfg/ti_board_open_close.o


So instead I have modified the file flash_nor_ospi_quad_device_S25HL512T.c to match my type of flash. Using this method the project was built completely.

STEP 3:

SFDP table was used to modify the file flash_nor_ospi_quad_device_S25HL512T.c

STEP 4:

When running the example OSPI Flash I/O example the program is stuck in "infinite" loop which it doesnt exit.

Because it fails on this condition 

So my questions are: 

Is there something I have missed when trying to add custom flash driver? (desc. in Step 2)

Can you edit existing flash driver? (eg. flash_nor_ospi_quad_device_S25HL512T.c) 

If yes, why does the flash I/O example get stuck in the while loop?

Thank you very much for your help.

Dominik Ondra

  • Hi Dominik,

    Did you do all the steps listed in file: AM243x MCU+ SDK: Writing flash driver for a custom flash device

    There are several files need to be changed:

    makefile.{soc}.{core}.ti-arm-clang under FILES_common

    The flash sysconfig also should be updated so that later in examples the flash can be selected appropriately. For this open the /source/board/.meta/flash/flash_{soc}.syscfg.js file. The object flash_devices will have a number of entries corresponding to the currently supported flashes. Add a new entry corresponding the new flash.

    You will also need to re-build all the libraries by executing "gmake -f makefile.am243x libs" at the top level of the MCU+ SDK

    for example: C:\ti\mcu_plus_sdk_am243x_08_02_00_31

    Confirm that the files build and the new flash device is selectable in sysconfig. We can now update the files according to the new flash device. 

    Update the example.syscfg of the ospi_flash_io example OSPI Flash IO using SysConfig GUI to select the new flash device you have added.

    Build and run the example

    Best regards,

    Ming

  • Hello Ming,

    Excellent advice. The Issue was in not rebuilding the library. I have managed to run the flash diag I/O example.
    I have only changed the flash type in sysconfig.


    In ospi_flash.io I have changed the OFFSET base to,:

        #define APP_OSPI_FLASH_OFFSET_BASE  (512*1024U)

    With this change the program was able to run uninterupted and not get suck. However the OSPI transaction didnt seem to go through,
    which cause the program to produce this error:

        OSPI read data mismatch !!!

        OSPI read data mismatch !!!

    I have debugged the program and the Rx buffer "gOspiRxBuf[[]" stays at zero and all indexes, which ultimately causes the error mentioned 
    above. The "status" variable stays at succes the whole run. Besides when  on line 74 of ospi_flash_io.c

        status |= ospi_flash_io_compare_buffers(); 

    is called. Which causes the status to become failure.

    What would the next steps be to eliminate possible mistake?

  • Hi Dominik,

    When ospi_flash_io_compare_buffers fails, it means either the write operation is failed  or the read operation is failed or both are failed.

    1. First, make sure the offset is still in range of the flash (< 1MB).

    2. Comment out Flash_write. After Flash_read, gOspiRxBuf should be all 1s. If that is the case, then the Flash_write somehow does not work.

    Best regards,

    Ming

  • Hello,

    Can I ask you whether or not this issue has been resolved? because in my project, very similar QSPI nor flash will be used.

    I would appreciate it if you share the result of your debugging.

    Regards,

    Moonil

  • Hi Dominik,

    Any progress?

    Best regards,

    Ming

  • Hello Ming and Moonil,
    I have copied the flash_nor_ospi_quad.c added a flash_nor_ospi_quad_device_IS25LP080D.c file. 
    And followed the guide in SDK to activate the 114 and 444 mode. Since the flashes are from different family,
    there needs to be more changes in the flash_nor_ospi_quad.c then the guide suggests to reflect the flash datasheet.
    Most of these changes can be discovered by looking at SFDP table to see which values are zero. However there really
    needs to be a lot of trial and error and debugging.

    However I still face problem with 114 and 444 mode NOT working on the same OSPI frequency. Is it possible/advised to
    change sysconfig values mid run ?

    Thank you for your time and have a nice day.

    Dominik

  • Hi Dominic,

    I am not sure I understand your question here: " Is it possible/advised to change sysconfig values mid run?"

    Since you are using your own customized flash driver, the SysConfig is only used to SELECT(pick) the correct flash driver and rebuild the examples which depends on the flash driver, like sbl_jtag_uniflash or sbl_ospi etc.

    Best regards,

    Ming

  • Hello Ming, 

    let me clarify my question. I setup in my sysconfig so OSPI is running at 25Mhz.
    Is it possible to change it to 50Mhz DURING the run of the program ?

    Thank you for time,

    Dominik 

  • Hi Dominik,

    As you can see from the below syscfg screen capture. The OSPI is set to 50Mhz (200Mhz/4):

    Of course, you can change the OSPI frequency at run time, but you have to de-initialize the OSPI and re-initialize it using your new frequency settings. What Syscfg does is to generate the OSPI initialization code based on your selection:

    Best regards,

    Ming

  • Thank you very mucjh Ming and have a nice day.

  • Hi Dominik and Ming,

    Could you let me know your setting value for bootmode[15:0] for IS25PL080D flash memory?

    Especially, what is your setting for bootmode[9]? 0 or 1?

    In the datasheet, this pin is related to SFDP enabled/disabled and it seems to be 1 (enabled) only for xSPI boot.

    I would like to make sure that bootmode[9] can be 0 when we use a none-xSPI flash like IS25PL080D or IS25LP064A.

    I would appreciate it if you just share the setting value configured in your device.

    Regards,

    Moonil 

  • Hi Moonil,

    I do not know what mode Dominik is finally used on his board. To set the SPI flash boot mode for AM243x GP EVM, please refer to the "4.3.1 BOOTMODE Pin Mapping" in TRM (Table 4-2 to Table 4-5). Please notice that the SW-2 pin 1-8 corresponding to B0 - B7 and SW-3 pin 1-8 corresponding to B8-15. 

    You can try the OSPI/QSPI/SPI or xSPI accordingly.

    As of bootmode[9], it should be corresponding to B8.

    For QSPI and QSPI, it should be "Iclk", therefore it should be "ON".

    For SPI, it is "Mode", "OFF" for SPI Mode 0 and "ON" for SPI Mode 3. 

    For xSPI, it is "SFDP", "OFF" for SFDP disabled and "ON" for SPDF enabled.

    Best regards,

    Ming

  • Hey Moonil, I have been using UART bootmode, because without driver I couldnt use SBL_NULL/SBL_OSPI.
    After finishing the driver and programming the SBL_NULL I had to use SPI  bootmode (bootpin 1 and 2 on, 3-9 off)
    Because from what I understood, the ROM bootloader, couldnt read the SBL in QSPI mode.

    Have a nice day and lot of success,

    Dominik