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.

TDA4VM-Q1: OSPI_Baremetal_Flash_TestApp failed

Part Number: TDA4VM-Q1

Hello TI experts,

1. Environments:

RTOS SDK 8.4

Custom board Nor flash: MT35XU01GBBA1G12 (similar as j721e_evm default MT35XU512ABA1G12, So few changes are required)

Boot mode: "SD + SBL"

OSPI_Baremetal_Flash_TestApp: make -s -o0 BOARD=j721e_evm CORE=mcu1_0 BUILD_PROFILE=debug OSPI_Baremetal_Flash_TestApp

2. Problems:

Logs: Board_flashOpen failed.

3. Code debug:

follow guidelines: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1121933/faq-tda4vm-debugging-sbl-boot-in-rtos-sdk

I found that “norHandle = 0”(return value of Nor_ospiOpen()) causing this issue .

is there something i did wrong?

  • In Nor_ospiReadId() function, read the manufacture id is 0x00 and device id is 0x00.

  • Hi Jesen,

    Can you please check the following FAQ https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1104992/faq-tda4vm-how-to-add-support-for-new-flash-device-in-rtos-sdk and confirm that you have made all the required changes?

    Regards,
    Parth

  • Hi Parth,

    Yes, MT35XU01GBBA1G12 similar to default MT35XU512ABA1G12, I just changed device id and NOR_SIZE.

  • Hi Jesen,

    Can you please share a patch of changes done along with the data sheet of the flash you are using if possible?

    Regards,
    Parth

  • Hi Parth,

    Here is the changes("<" is my current code):

    diff -r packages\ti\drv\spi\test\ospi_flash\src\main_ospi_flash_test.c packages\ti\drv\spi\test\ospi_flash\src\main_ospi_flash_test.c
    802c802
    <     deviceId = BOARD_FLASH_ID_MT35XU01GBBA1G12;
    ---
    >     deviceId = BOARD_FLASH_ID_MT35XU512ABA1G12;
    
    diff -r packages\ti\board\src\flash\nor\device\m35xu512.h packages\ti\board\src\flash\nor\device\m35xu512.h
    56c56
    < #define NOR_SIZE                     (128U * 1024U * 1024U)
    ---
    > #define NOR_SIZE                     (64U * 1024U * 1024U)
    109c109
    < #define NOR_DEVICE_ID                (0x5B1B)   /* Device ID */
    ---
    > #define NOR_DEVICE_ID                (0x5B1A)   /* Device ID */
    
    diff -r packages\ti\board\src\flash\board_flash.c packages\ti\board\src\flash\board_flash.c
    83d82
    <             (deviceId == BOARD_FLASH_ID_MT35XU01GBBA1G12) || \
    139d137
    <         (deviceId == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    245d242
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    311d307
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    400d395
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)  || \
    481d475
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    556d549
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    625d617
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    715d706
    <         (flashInfo->device_id == BOARD_FLASH_ID_MT35XU01GBBA1G12)	 || \
    
    diff -r packages\ti\board\src\flash\include\board_flash.h packages\ti\board\src\flash\include\board_flash.h
    116d115
    < #define BOARD_FLASH_ID_MT35XU01GBBA1G12    (0x5B1BU) /**< Micro 1024Mb NOR flash device Id  */
    
    
    

    is there something i missed? 

  • Hi Jesen,

    These changes seems fine. Did you re-build the board library after the above changes?

    Regards,
    Parth

  • Yes,but it's still failed. Actually, i am trying to porting from SDK 7.3 to SDK 8.4. On the other hand, our team have developed software by using "sbl + ospi" bootup mode on SDK 7.3, and it works well. but OSPI_Baremetal_Flash_TestApp or other ospi flash test example also Board_flashOpen failed on SDK 7.3, related code in "sbl_ospi.c" of SDK 7.3 is on below.

    static void *boardHandle = NULL;
    
    static OSPI_v0_HwAttrs ospi_cfg;
    
    int32_t SBL_DV_ospiInit(void *handle)
    {
    #if (!defined(SBL_BYPASS_OSPI_DRIVER) \
         /* In simulation, we must ALWAYS bypass the OSPI driver regardless of what */ \
         /* .. bypass option is requested. REMOVE WHEN SIMULATION IS IRRELEVANT. */ \
         && !(defined(SBL_BYPASS_OSPI_DRIVER_FOR_SYSFW_DOWNLOAD) && defined(SIM_BUILD)))
    
        Board_flashHandle h = *(Board_flashHandle *) handle;
        static uint32_t enableTuning = TRUE;
    
        SBL_ADD_PROFILE_POINT;
    
        if (h)
        {
            Board_flashClose(h);
            SBL_ADD_PROFILE_POINT;
    
        }
    
        /* Get default OSPI cfg */
        OSPI_socGetInitCfg(BOARD_OSPI_NOR_INSTANCE, &ospi_cfg);
    
    #if !defined(SBL_SKIP_BRD_CFG_PM) && !defined(SBL_SKIP_SYSFW_INIT)
        {
            struct ospiClkParams
            {
                uint32_t moduleId;
                uint32_t clockId;
            };
            struct ospiClkParams ospiClkInfo[] = {
                                                    {SBL_DEV_ID_OSPI0, SBL_CLK_ID_OSPI0},
    #ifdef SBL_DEV_ID_OSPI1
                                                    {SBL_DEV_ID_OSPI1, SBL_CLK_ID_OSPI1},
    #endif
                                                 };
            uint64_t ospiFunClk;
    
            /* System Firmware reconfigures the OSPI clock to
             * unsupported values. This is a workaround until
             * that issue is fixed
             */
    #if defined(SOC_AM64X)
            ospiFunClk = (uint64_t)(OSPI_MODULE_CLK_166M);
    #else
            ospiFunClk = (uint64_t)(OSPI_MODULE_CLK_133M);
    #endif
            Sciclient_pmSetModuleClkFreq(ospiClkInfo[BOARD_OSPI_NOR_INSTANCE].moduleId, ospiClkInfo[BOARD_OSPI_NOR_INSTANCE].clockId, ospiFunClk, TISCI_MSG_FLAG_AOP, SCICLIENT_SERVICE_WAIT_FOREVER);
            ospi_cfg.funcClk = (uint32_t)ospiFunClk;
            SBL_log(SBL_LOG_MAX, "ospiFunClk = %d Hz \n", ospi_cfg.funcClk);
        }
    #endif
    
        ospi_cfg.dtrEnable = true;
    
    #if defined(SOC_J7200)
        ospi_cfg.funcClk = OSPI_MODULE_CLK_133M;
    #elif defined(SOC_AM64X)
        ospi_cfg.funcClk = OSPI_MODULE_CLK_166M;
    #endif
    
    #if SBL_USE_DMA
        ospi_cfg.dmaEnable = true;
        Ospi_udma_init(&ospi_cfg);
    #endif
    
    #if SBL_USE_DMA
        /* J721E: PHY mode was already previously enabled, so we keep it enabled */
        /* J7200/AM64X: Enable the PHY mode which was disabled in SBL_ReadSysfwImage */
        ospi_cfg.phyEnable = true;
    #else
    #if defined(SOC_J721E)
        ospi_cfg.phyEnable = true;
        ospi_cfg.cacheEnable = true;
    #else
        ospi_cfg.phyEnable = false;
    #endif
    #endif
    
    #if 1
        // UART_printf("[xxx] in SBL_ospiInit(), default dac = %d, phy = %d, dtr = %d, cache = %d, baudRateDiv = %d\n", \
        //          ospi_cfg.dacEnable, ospi_cfg.phyEnable, ospi_cfg.dtrEnable, ospi_cfg.cacheEnable, ospi_cfg.baudRateDiv);
        ospi_cfg.dtrEnable = false;
        ospi_cfg.phyEnable = false;
        ospi_cfg.dacEnable = true;;
        ospi_cfg.cacheEnable = false;;
        enableTuning = false;
        // UART_printf("[xxx] in SBL_ospiInit(), force dac = %d, phy = %d, dtr = %d, cache = %d, baudRateDiv = %d\n", \
        //         ospi_cfg.dacEnable, ospi_cfg.phyEnable, ospi_cfg.dtrEnable, ospi_cfg.cacheEnable, ospi_cfg.baudRateDiv);
    #endif
    
        /* Set the default SPI init configurations */
        OSPI_socSetInitCfg(BOARD_OSPI_NOR_INSTANCE, &ospi_cfg);
    
    #if defined(SOC_J7200) || defined(SOC_AM64X)
        h = Board_flashOpen(BOARD_FLASH_ID_S28HS512T,
                            BOARD_OSPI_NOR_INSTANCE, (void *)(enableTuning));
    #else
        h = Board_flashOpen(BOARD_FLASH_ID_MT35XU01GBBA1G12,
                                BOARD_OSPI_NOR_INSTANCE, (void *)(enableTuning));
    #endif
        if (h)
        {
            *(Board_flashHandle *) handle = h;
            /* Update the static handle as well, for later use */
            boardHandle = (void *)h;
    
            SBL_log(SBL_LOG_MIN, "\n OSPI NOR device ID: 0x%x, manufacturer ID: 0x%x \n",
                    ((Board_FlashInfo *)h)->device_id, ((Board_FlashInfo *)h)->manufacturer_id);
    #if !(SBL_USE_DMA) && !defined(SOC_J721E)
            /* Disable PHY pipeline mode if not using DMA */
            CSL_ospiPipelinePhyEnable((const CSL_ospi_flash_cfgRegs *)(ospi_cfg.baseAddr), FALSE);
    #endif
        }
        else
        {
            SBL_log(SBL_LOG_ERR, "Board_flashOpen failed!\n");
            SblErrLoop(__FILE__, __LINE__);
        }
    
        SBL_ADD_PROFILE_POINT;
    
        return 0;
    #else
        SBL_ADD_PROFILE_POINT;
    
        SBL_ADD_PROFILE_POINT;
        return 0;
    #endif
    }

  • Hi Jesen,

    So you are able to boot from the OSPI with the above changes on 7.3, but with the same changes OSPI tests are failing during boardflas_open also on 7.3?

    Regards,
    Parth

  • Hi Parth,

    Yes, It doesn't make any sense. i'm going to boot from OSPI with the above changes on SDK 8.4, or can you give me some other suggestions?

  • Unfortunately, failed on 8.4.

    SBL Revision: 01.00.10.01 (Nov 15 2022 - 15:33:24)
    ATCM ...Board_flashOpen failed!
    SBL Revision: 01.00.10.01 (Nov 15 2022 - 15:33:24)
    ATCM ...Board_flashOpen failed!
    
    

  • Hi Parth,

    I have some macros to be confirmed in "/board/src/j721e_evm/include/board_cfg.h", is that "BOARD_OSPI_DOMAIN" means "BOARD_SOC_DOMAIN_xxxx"?

    /* OSPI Domain number */
    #define BOARD_OSPI_DOMAIN                               (0U)
    
    /* Maximum number of SoC domains */
    #define BOARD_SOC_DOMAIN_MAX     (3U)
    /* Value for indicating SoC main domain */
    #define BOARD_SOC_DOMAIN_MAIN    (0)
    /* Value for indicating SoC wake-up domain */
    #define BOARD_SOC_DOMAIN_WKUP    (1U)
    /* Value for indicating SoC MCU domain */
    #define BOARD_SOC_DOMAIN_MCU     (2U)
    /* Maximum I2C instance number common across the domain */
    #define BOARD_I2C_DOMAIN_INSTANCE_MAX     (2U)

  • HI Jesen,

    From 7.3 to 8.4 there, one major change happened is compiler migration. Have you taken care of that? Please check https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/08_01_00_11/exports/docs/pdk_jacinto_08_01_00_33/docs/userguide/jacinto/developer_notes/ticlang_Migrationguidelines.html#ticlang-migration-guidelines for details.

    I have some macros to be confirmed in "/board/src/j721e_evm/include/board_cfg.h", is that "BOARD_OSPI_DOMAIN" means "BOARD_SOC_DOMAIN_xxxx"?

    I'll check this and get back to you.

    Regards,
    Parth

  • Hi Parth,

    i'm going to boot from OSPI with the above changes on SDK 8.4

    I tried it again with changes "ospi_cfg.dtrEnable = false;" base on the topic https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1098951/tda4vm-how-to-porting-new-ospi-flash-device-in-rtos-sdk/4073626#4073626,

    than i readed the device ID and manufacturer ID correctly in "sbl_ospi.c/SBL_ReadSysfwImage()", but failed in "sbl_ospi.c/SBL_OSPIBootImage()/SBL_OSPI_Initialize()/SBL_ospiInit()/".

    I guess some ospi_cfg parameters may be wrong.

  • Hi Jasen,

    Have you tried setting ospi_cfg.dtrEnable = false in SBL_ospiInit as well?

    Regards,
    Parth

  • Hi Parth,

    Have you tried setting ospi_cfg.dtrEnable = false in SBL_ospiInit as well?

    Yes, not working.

    Yes,but it's still failed. Actually, i am trying to porting from SDK 7.3 to SDK 8.4. On the other hand, our team have developed software by using "sbl + ospi" bootup mode on SDK 7.3, and it works well. but OSPI_Baremetal_Flash_TestApp or other ospi flash test example also Board_flashOpen failed on SDK 7.3, related code in "sbl_ospi.c" of SDK 7.3 is on below.

    avove changes added, Board_flashOpen failed again.

  • Hi Parth,

    than i readed the device ID and manufacturer ID correctly in "sbl_ospi.c/SBL_ReadSysfwImage()", but failed in "sbl_ospi.c/SBL_OSPIBootImage()/SBL_OSPI_Initialize()/SBL_ospiInit()/".

    After setting ospi_cfg.dtrEnable = false,  I dumped all ospi_cfg configurations in SBL_ReadSysfwImage(), and set to ospi_cfg in SBL_ospiInit(), device ID and manufacturer ID readbacked in SBL_ReadSysfwImage(), but Board_flashOpen failed in SBL_ospiInit().

    if (h)
    {
        Board_flashClose(h);
        SBL_ADD_PROFILE_POINT;
    }
    
    OSPI_socGetInitCfg(BOARD_OSPI_DOMAIN, BOARD_OSPI_NOR_INSTANCE, &ospi_cfg);
    
    OSPI_socSetInitCfg(BOARD_OSPI_DOMAIN, BOARD_OSPI_NOR_INSTANCE, &ospi_cfg);
    
    h = Board_flashOpen(BOARD_FLASH_ID_MT35XU01GBBA1G12,
                        BOARD_OSPI_NOR_INSTANCE, NULL);
                        
    if (h)
    {
        SBL_ADD_PROFILE_POINT;
                SBL_log(SBL_LOG_MIN, "OSPI NOR device ID: 0x%x, manufacturer ID: 0x%x \n",
                        ((Board_FlashInfo *)h)->device_id, ((Board_FlashInfo *)h)->manufacturer_id);
        boardHandle = (void *)h;
        }
    else
    {
        SBL_log(SBL_LOG_ERR, "Board_flashOpen failed!\n");
        SblErrLoop(__FILE__, __LINE__);
    }
    
    SBL_ADD_PROFILE_POINT;

    above code added in SBL_ReadSysfwImage(), device ID and manufacturer ID readbacked twice. 

    Does TI tested 8.4's OSPI Flash on EVM?

    Or other pdk module needed changing?

  • After setting ospi_cfg.dtrEnable = false,  I dumped all ospi_cfg configurations in SBL_ReadSysfwImage(), and set to ospi_cfg in SBL_ospiInit(), device ID and manufacturer ID readbacked in SBL_ReadSysfwImage(), but Board_flashOpen failed in SBL_ospiInit().

    Actually it's affected by the code(SBL_ConfigureEthernet()) between SBL_ReadSysfwImage() and SBL_BootImage(&k3xx_evmEntry) in "sbl_main.c",

    #if defined(SOC_J721E) || (!defined(SBL_ENABLE_HLOS_BOOT) && defined(SOC_J7200)) || defined(SOC_J784S4)
        /* Configure external Ethernet PHY and pinmux */
        // SBL_ConfigureEthernet();
    #endif

    Although i don't the exactly causing, I'll keep an eye on it in later work.