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.

LP-AM243: Custom flash

Part Number: LP-AM243
Other Parts Discussed in Thread: AM2431, , SYSCONFIG, UNIFLASH

Hi all TI experts,

I am currently developing on the AM2431 platform, using the W25Q16JV as the external flash model. The SDK version I'm using is mcu_plus_sdk_am243x_09_00_00_35.

I replaced the external flash on the LP-AM243 with the W25Q16JV, which is the flash our product uses. Following the methods provided in the document at

https://software-dl.ti.com/mcu-plus-sdk/esd/AM243X/latest/exports/docs/api_guide_am243x/CUSTOM_FLASH_SUPPORT_GUIDE.html,

I executed the procedure and obtained the following results:

{

	"flashSize": 2097152,
	"flashPageSize": 256,
	"flashManfId": "0xEF",
	"flashDeviceId": "0x4015",
	"flashBlockSize": 65536,
	"flashSectorSize": 4096,
	"cmdBlockErase3B": "0xD8",
	"cmdBlockErase4B": "0xD8",
	"cmdSectorErase3B": "0x20",
	"cmdSectorErase4B": "0x20",
	"protos": {
		"p111": {
			"isDtr": false,
			"cmdRd": "0x03",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 0,
			"dummyClksRd": 0,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": null,
			"protoCfg": null,
			"strDtrCfg": null
		},
		"p112": {
			"isDtr": false,
			"cmdRd": "0x3B",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 0,
			"dummyClksRd": 8,
			"enableType": "0",
			"enableSeq": "0x00",
			"dummyCfg": null,
			"protoCfg": null,
			"strDtrCfg": null
		},
		"p114": {
			"isDtr": false,
			"cmdRd": "0x6B",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 0,
			"dummyClksCmd": 0,
			"dummyClksRd": 8,
			"enableType": "4",
			"enableSeq": "0x00",
			"dummyCfg": null,
			"protoCfg": null,
			"strDtrCfg": null
		},
		"p118": null,
		"p444s": {
			"isDtr": false,
			"cmdRd": "0xEB",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 2,
			"dummyClksCmd": 0,
			"dummyClksRd": 0,
			"enableType": "4",
			"enableSeq": "0x11",
			"dummyCfg": {
				"isAddrReg": false,
				"cmdRegRd":"0x00",
				"cmdRegWr":"0x00",
				"cfgReg":"0x00000000",
				"shift":0,
				"mask":"0x00",
				"bitP":0
			},
			"protoCfg": {
				"isAddrReg": false,
				"cmdRegRd": "0x00",
				"cmdRegWr": "0x00",
				"cfgReg": "0x00000000",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			},
			"strDtrCfg": {
				"isAddrReg": false,
				"cmdRegRd": "0x00",
				"cmdRegWr": "0x00",
				"cfgReg": "0x00000000",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			}
		},
		"p444d": {
			"isDtr": false,
			"cmdRd": "0xEB",
			"cmdWr": "0x02",
			"modeClksCmd": 0,
			"modeClksRd": 2,
			"dummyClksCmd": 0,
			"dummyClksRd": 0,
			"enableType": "4",
			"enableSeq": "0x11",
			"dummyCfg": {
				"isAddrReg": false,
				"cmdRegRd":"0x00",
				"cmdRegWr":"0x00",
				"cfgReg":"0x00000000",
				"shift":0,
				"mask":"0x00",
				"bitP":0
			},
			"protoCfg": {
				"isAddrReg": false,
				"cmdRegRd": "0x00",
				"cmdRegWr": "0x00",
				"cfgReg": "0x00000000",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			},
			"strDtrCfg": {
				"isAddrReg": false,
				"cmdRegRd": "0x00",
				"cmdRegWr": "0x00",
				"cfgReg": "0x00000000",
				"shift": 0,
				"mask": "0x00",
				"bitP": 0
			}
		},
		"p888s": null,
		"p888d": null,
		"pCustom": { 
			"fxn": null
		}
	},
	"addrByteSupport": "0",
	"fourByteAddrEnSeq": "0x80",
	"cmdExtType": "NONE",
	"resetType": "0x30",
	"deviceBusyType": "1",
	"cmdWren": "0x06",
	"cmdRdsr": "0x05",
	"srWip":  0,
	"srWel":  1,
	"cmdChipErase": "0xC7",
	"rdIdSettings": {
		"cmd": "0x9F",
		"numBytes": 5,
		"dummy4": 0,
		"dummy8": 0
	},
	"xspiWipRdCmd": "0x00",
	"xspiWipReg": "0x00000000",
	"xspiWipBit": 0,
	"flashDeviceBusyTimeout": 5120000,
	"flashPageProgTimeout": 704
}

Since I am using uart_unflash to program the SBL and application into the AM243, I need to modify the flash-related parts in both SBL and SBL_UART_unflash. My SBL is SBL_OSPI. Following the document's guidance, I imported the JSON file into the sysconfig of both SBL_UART_uniflash and SBL_OSPI. Here are the issues I encountered:

In the first scenario, both SBL_UART_uniflash and SBL_OSPI are set to 1s-1s-1s configurations. When I attempt to flash the firmware to the LP-AM243 using uart_flash.py, the first command successfully writes SBL_UART_uniflash to RAM without any issues. However, the second command, which is intended to flash SBL_OSPI, should initiate SBL_UART_uniflash to start receiving SBL_OSPI. Yet, the process consistently freezes at this point without any progression. From my assessment, it appears that SBL_UART_uniflash encounters an issue at this stage, possibly getting stuck and unable to proceed with the flashing operation.

In the second scenario, SBL_UART_uniflash is configured as 4s-4s-4s and SBL_OSPI as 1s-1s-1s. The flashing process using uart_flash.py completes without any issues, and all three commands are successfully executed, resulting in both the SBL and application being correctly programmed. However, upon booting in OSPI mode, a log message appears stating, "Some tests have failed!!". Further investigation reveals that the issue originates from the Bootloader_parseMultiCoreAppImage function, which returns a status of false.

In the third scenario, both SBL_UART_uniflash and SBL_OSPI are configured as 4s-4s-4s. The flashing process completes without any issues, and the system successfully boots from OSPI mode into the application. However, there is a problem where the application is unable to perform a software reset. This issue was discussed in another thread, which can be found at the following link:

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1332414/am2431-software-reset.

The conclusion from that discussion is that when testing the application alone, setting the application's flash configuration to 1s-1s-1s allows the software reset to function properly. Thus, it is inferred that the SBL might be facing a similar issue, indicating a need to test with all flash configurations set to 1s-1s-1s.

Did I do anything wrong? I also referred to the [FAQ] written by another TI expert on "How to debug/develop/migrate the flash driver for custom flash on non-TI EVM" available at: https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1230063/faq-mcu-plus-sdk-am243x-faq-how-to-debug-develop-migrate-the-flash-driver-for-custom-flash-on-non-ti-evm-ospi-xspi

However, I still can't identify the problem. Is there something wrong with my approach?

As an aside, I did manage to damage this flash during testing. The situation was that the UART flashing process completed successfully, but when booting in OSPI mode, no logs appeared. Debug mode revealed that the address was consistently at 0x418019F0. According to TI experts in another discussion thread, this is a ROM address. I suspect it's stuck in the RBL, possibly because the RBL is unable to gain control of the external flash, thus causing it to hang. This situation is identical to what I observed when testing the software reset. I wonder if there is some connection between these issues.

Best,

Larry

  • Hi Larry,

    There is so much context in the query. Let's take it step by step.

    Are you able to flash using `sbl_uart_uniflash`? If you are, this will confirm the flash is not yet damaged.

    Regards,

    Prashant

  • Hi Prashant,

    These are actually two separate issues. I once encountered a situation where the flash was damaged; regardless of how I configured sbl_uart_uniflash, it could operate, but the flashed SBL could not function properly, leading me to conclude that the flash was damaged. The other issue I encountered is that I can flash the firmware when sbl_uart_uniflash is set to 4s-4s-4s, but not when it is set to 1s-1s-1s.

    Best,

    Larry

  • Hi Larry,

    If the `sbl_uart_uniflash` is able to flash in any mode, the flash part is okay.

    I can flash the firmware when sbl_uart_uniflash is set to 4s-4s-4s, but not when it is set to 1s-1s-1s.

    This might be due to the incorrect flash configurations in 1s-1s-1s. Please make sure you are following the below steps when switching the protocols

    1) Select the desired protocol.

    2) Load JSON config using "Load from JSON" button.

    3) Save and exit.

    4) Rebuild the `sbl_uart_uniflash`.

    Let me know if this works.

    Regards,

    Prashant

  • Hi Prashant,

    It still can't work with 1s-1s-1s, below is my JASON file and my sysconfig file content, I think I follow all step provide by you.

    {
    
    	"flashSize": 2097152,
    	"flashPageSize": 256,
    	"flashManfId": "0xEF",
    	"flashDeviceId": "0x4015",
    	"flashBlockSize": 65536,
    	"flashSectorSize": 4096,
    	"cmdBlockErase3B": "0xD8",
    	"cmdBlockErase4B": "0xD8",
    	"cmdSectorErase3B": "0x20",
    	"cmdSectorErase4B": "0x20",
    	"protos": {
    		"p111": {
    			"isDtr": false,
    			"cmdRd": "0x03",
    			"cmdWr": "0x02",
    			"modeClksCmd": 0,
    			"modeClksRd": 0,
    			"dummyClksCmd": 0,
    			"dummyClksRd": 0,
    			"enableType": "0",
    			"enableSeq": "0x00",
    			"dummyCfg": null,
    			"protoCfg": null,
    			"strDtrCfg": null
    		},
    		"p112": {
    			"isDtr": false,
    			"cmdRd": "0x3B",
    			"cmdWr": "0x02",
    			"modeClksCmd": 0,
    			"modeClksRd": 0,
    			"dummyClksCmd": 0,
    			"dummyClksRd": 8,
    			"enableType": "0",
    			"enableSeq": "0x00",
    			"dummyCfg": null,
    			"protoCfg": null,
    			"strDtrCfg": null
    		},
    		"p114": {
    			"isDtr": false,
    			"cmdRd": "0x6B",
    			"cmdWr": "0x02",
    			"modeClksCmd": 0,
    			"modeClksRd": 0,
    			"dummyClksCmd": 0,
    			"dummyClksRd": 8,
    			"enableType": "4",
    			"enableSeq": "0x00",
    			"dummyCfg": null,
    			"protoCfg": null,
    			"strDtrCfg": null
    		},
    		"p118": null,
    		"p444s": {
    			"isDtr": false,
    			"cmdRd": "0xEB",
    			"cmdWr": "0x02",
    			"modeClksCmd": 0,
    			"modeClksRd": 2,
    			"dummyClksCmd": 0,
    			"dummyClksRd": 0,
    			"enableType": "4",
    			"enableSeq": "0x11",
    			"dummyCfg": {
    				"isAddrReg": false,
    				"cmdRegRd":"0x00",
    				"cmdRegWr":"0x00",
    				"cfgReg":"0x00000000",
    				"shift":0,
    				"mask":"0x00",
    				"bitP":0
    			},
    			"protoCfg": {
    				"isAddrReg": false,
    				"cmdRegRd": "0x00",
    				"cmdRegWr": "0x00",
    				"cfgReg": "0x00000000",
    				"shift": 0,
    				"mask": "0x00",
    				"bitP": 0
    			},
    			"strDtrCfg": {
    				"isAddrReg": false,
    				"cmdRegRd": "0x00",
    				"cmdRegWr": "0x00",
    				"cfgReg": "0x00000000",
    				"shift": 0,
    				"mask": "0x00",
    				"bitP": 0
    			}
    		},
    		"p444d": {
    			"isDtr": false,
    			"cmdRd": "0xEB",
    			"cmdWr": "0x02",
    			"modeClksCmd": 0,
    			"modeClksRd": 2,
    			"dummyClksCmd": 0,
    			"dummyClksRd": 0,
    			"enableType": "4",
    			"enableSeq": "0x11",
    			"dummyCfg": {
    				"isAddrReg": false,
    				"cmdRegRd":"0x00",
    				"cmdRegWr":"0x00",
    				"cfgReg":"0x00000000",
    				"shift":0,
    				"mask":"0x00",
    				"bitP":0
    			},
    			"protoCfg": {
    				"isAddrReg": false,
    				"cmdRegRd": "0x00",
    				"cmdRegWr": "0x00",
    				"cfgReg": "0x00000000",
    				"shift": 0,
    				"mask": "0x00",
    				"bitP": 0
    			},
    			"strDtrCfg": {
    				"isAddrReg": false,
    				"cmdRegRd": "0x00",
    				"cmdRegWr": "0x00",
    				"cfgReg": "0x00000000",
    				"shift": 0,
    				"mask": "0x00",
    				"bitP": 0
    			}
    		},
    		"p888s": null,
    		"p888d": null,
    		"pCustom": { 
    			"fxn": null
    		}
    	},
    	"addrByteSupport": "0",
    	"fourByteAddrEnSeq": "0x80",
    	"cmdExtType": "NONE",
    	"resetType": "0x30",
    	"deviceBusyType": "1",
    	"cmdWren": "0x06",
    	"cmdRdsr": "0x05",
    	"srWip":  0,
    	"srWel":  1,
    	"cmdChipErase": "0xC7",
    	"rdIdSettings": {
    		"cmd": "0x9F",
    		"numBytes": 5,
    		"dummy4": 0,
    		"dummy8": 0
    	},
    	"xspiWipRdCmd": "0x00",
    	"xspiWipReg": "0x00000000",
    	"xspiWipBit": 0,
    	"flashDeviceBusyTimeout": 5120000,
    	"flashPageProgTimeout": 704
    }

    /**
     * These arguments were used when this file was generated. They will be automatically applied on subsequent loads
     * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments.
     * @cliArgs --device "AM243x_ALX_beta" --package "ALX" --part "ALX" --context "r5fss0-0" --product "MCU_PLUS_SDK_AM243x@09.00.00"
     * @versions {"tool":"1.17.0+3128"}
     */
    
    /**
     * Import the modules used in this configuration.
     */
    const flash       = scripting.addModule("/board/flash/flash", {}, false);
    const flash1      = flash.addInstance();
    const bootloader  = scripting.addModule("/drivers/bootloader/bootloader", {}, false);
    const bootloader1 = bootloader.addInstance();
    const uart        = scripting.addModule("/drivers/uart/uart", {}, false);
    const uart1       = uart.addInstance();
    const clock       = scripting.addModule("/kernel/dpl/clock");
    const debug_log   = scripting.addModule("/kernel/dpl/debug_log");
    const mpu_armv7   = scripting.addModule("/kernel/dpl/mpu_armv7", {}, false);
    const mpu_armv71  = mpu_armv7.addInstance();
    const mpu_armv72  = mpu_armv7.addInstance();
    const mpu_armv73  = mpu_armv7.addInstance();
    const mpu_armv74  = mpu_armv7.addInstance();
    
    /**
     * Write custom configuration values to the imported modules.
     */
    flash1.$name                              = "CONFIG_FLASH0";
    flash1.flashSize                          = 2097152;
    flash1.flashManfId                        = "0xEF";
    flash1.flashDeviceId                      = "0x4015";
    flash1.flashBlockSize                     = 65536;
    flash1.cmdBlockErase4B                    = "0xD8";
    flash1.cmdSectorErase4B                   = "0x20";
    flash1.dummyClksRd                        = 0;
    flash1.dummy_isAddrReg                    = false;
    flash1.dummy_cmdRegRd                     = "0x00";
    flash1.dummy_cmdRegWr                     = "0x00";
    flash1.dummy_cfgReg                       = "0x00000000";
    flash1.dummy_mask                         = "0x00";
    flash1.dummy_bitP                         = 0;
    flash1.resetType                          = "0x30";
    flash1.addressByteSupport                 = "0";
    flash1.idNumBytes                         = 5;
    flash1.fourByteEnableSeq                  = "0x80";
    flash1.device                             = "CUSTOM_FLASH";
    flash1.fname                              = "W25Q16JV";
    flash1.flashDeviceBusyTimeout             = 5120000;
    flash1.flashPageProgTimeout               = 704;
    flash1.protocol                           = "1s_1s_1s";
    flash1.cmdRd                              = "0x03";
    flash1.modeClksRd                         = 0;
    flash1.flash444Seq                        = "0x00";
    flash1.peripheralDriver.$name             = "CONFIG_OSPI0";
    flash1.peripheralDriver.dmaEnable         = true;
    flash1.peripheralDriver.OSPI.$assign      = "OSPI0";
    flash1.peripheralDriver.OSPI.CLK.$assign  = "OSPI0_CLK";
    flash1.peripheralDriver.OSPI.CSn0.$assign = "OSPI0_CSn0";
    flash1.peripheralDriver.OSPI.D3.$assign   = "OSPI0_D3";
    flash1.peripheralDriver.OSPI.D2.$assign   = "OSPI0_D2";
    flash1.peripheralDriver.OSPI.D1.$assign   = "OSPI0_D1";
    flash1.peripheralDriver.OSPI.D0.$assign   = "OSPI0_D0";
    
    bootloader1.bootMedia = "MEM";
    bootloader1.$name     = "CONFIG_BOOTLOADER_MEM";
    
    uart1.$name        = "CONFIG_UART0";
    uart1.intrEnable   = "DISABLE";
    uart1.UART.$assign = "USART0";
    
    const udma                         = scripting.addModule("/drivers/udma/udma", {}, false);
    const udma1                        = udma.addInstance({}, false);
    udma1.$name                        = "CONFIG_UDMA0";
    flash1.peripheralDriver.udmaDriver = udma1;
    
    clock.timerInputClkHz = 800000000;
    
    debug_log.enableCssLog      = false;
    debug_log.enableLogZoneInfo = true;
    
    mpu_armv71.$name             = "CONFIG_MPU_REGION0";
    mpu_armv71.size              = 31;
    mpu_armv71.attributes        = "Device";
    mpu_armv71.accessPermissions = "Supervisor RD+WR, User RD";
    mpu_armv71.allowExecute      = false;
    
    mpu_armv72.$name             = "CONFIG_MPU_REGION1";
    mpu_armv72.size              = 15;
    mpu_armv72.accessPermissions = "Supervisor RD+WR, User RD";
    
    mpu_armv73.$name             = "CONFIG_MPU_REGION2";
    mpu_armv73.baseAddr          = 0x41010000;
    mpu_armv73.size              = 15;
    mpu_armv73.accessPermissions = "Supervisor RD+WR, User RD";
    
    mpu_armv74.$name             = "CONFIG_MPU_REGION3";
    mpu_armv74.accessPermissions = "Supervisor RD+WR, User RD";
    mpu_armv74.baseAddr          = 0x70000000;
    mpu_armv74.size              = 21;
    
    /**
     * Pinmux solution for unlocked pins/peripherals. This ensures that minor changes to the automatic solver in a future
     * version of the tool will not impact the pinmux you originally saw.  These lines can be completely deleted in order to
     * re-solve from scratch.
     */
    uart1.UART.RXD.$suggestSolution = "UART0_RXD";
    uart1.UART.TXD.$suggestSolution = "UART0_TXD";
    

    Best,

    Larry

  • Hi Larry,

    Can you please share the generated ti_board_open_close.c source file?

  • Hi Prashant,

    Yes, sure.

    /*
     *  Copyright (C) 2021 Texas Instruments Incorporated
     *
     *  Redistribution and use in source and binary forms, with or without
     *  modification, are permitted provided that the following conditions
     *  are met:
     *
     *    Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     *    Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the
     *    distribution.
     *
     *    Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */
    
    /*
     * Auto generated file 
     */
    
    #include "ti_board_open_close.h"
    
    int32_t Board_driversOpen(void)
    {
        int32_t status = SystemP_SUCCESS;
        if(status==SystemP_SUCCESS)
        {
            status = Board_flashOpen();
        }
        return status;
    }
    
    void Board_driversClose(void)
    {
        Board_flashClose();
    }
    
    /*
     * FLASH
     */
    /* FLASH Object - initialized during Flash_open() */
    Flash_NorOspiObject gFlashObject_S25HL512T;
    
    /* FLASH Driver handles - opened during Board_flashOpen() */
    Flash_Handle gFlashHandle[CONFIG_FLASH_NUM_INSTANCES];
    
    /* FLASH Attrs */
    Flash_Attrs gFlashAttrs_S25HL512T =
    {
        .flashName = "S25HL512T",
        .deviceId = 0x4015,
        .manufacturerId = 0xEF,
        .flashSize = 2097152,
        .blockCount = 32,
        .blockSize = 65536,
        .pageCount = 256,
        .pageSize = 256,
        .sectorCount = 512,
        .sectorSize = 4096,
    };
    
    /* FLASH DevConfig */
    Flash_DevConfig gFlashDevCfg_S25HL512T =
    {
        .cmdExtType = OSPI_CMD_EXT_TYPE_NONE,
        .enable4BAddr = TRUE,
        .addrByteSupport = 0,
        .fourByteAddrEnSeq = 0x80,
        .cmdWren = 0x06,
        .cmdRdsr = 0x05,
        .srWip = (1 << 0),
        .srWel = (1 << 1),
        .xspiWipRdCmd = 0x00,
        .xspiWipReg = 0x00000000,
        .xspiWipBit = (1 << 0),
        .resetType = 0x30,
        .eraseCfg = {
            .blockSize = 65536,
            .sectorSize = 4096,
            .cmdBlockErase3B = 0xD8,
            .cmdBlockErase4B = 0xD8,
            .cmdSectorErase3B = 0x20,
            .cmdSectorErase4B = 0x20,
            .cmdChipErase = 0xC7,
        },
        .idCfg = {
            .cmd = 0x9F, /* Constant */
            .numBytes = 3,
            .dummy4 = 0,
            .dummy8 = 0,
        },
        .protocolCfg = {
            .protocol = FLASH_CFG_PROTO_1S_1S_1S,
            .isDtr = FALSE,
            .cmdRd = 0x03,
            .cmdWr = 0x02,
            .modeClksCmd = 0,
            .modeClksRd = 0,
            .dummyClksCmd = 0,
            .dummyClksRd = 0,
            .enableType = 0xFF,
            .enableSeq = 0xFF,
            .dummyCfg = {
                .isAddrReg = FALSE,
                .cmdRegRd = 0x00,
                .cmdRegWr = 0x00,
                .cfgReg = 0x00000000,
                .shift = 0,
                .mask = 0x00,
                .cfgRegBitP = 0,
            },
        },
        .flashWriteTimeout = 704,
        .flashBusyTimeout = 5120000,
    };
    
    /* FLASH Config */
    Flash_Config gFlashConfig[CONFIG_FLASH_NUM_INSTANCES] =
    {
        {
            .attrs = &gFlashAttrs_S25HL512T,
            .fxns = &gFlashNorOspiFxns,
            .devConfig = &gFlashDevCfg_S25HL512T,
            .object = (void *)&gFlashObject_S25HL512T,
        },
    };
    
    /* Externs of quirk functions and custom protocol functions */
    extern int32_t Flash_quirkSpansionUNHYSADisable(Flash_Config *config);
    
    /* FLASH Open Params - populated from SysConfig options */
    Flash_Params gFlashParams[CONFIG_FLASH_NUM_INSTANCES] =
    {
        {
            .quirksFxn = Flash_quirkSpansionUNHYSADisable,
            .custProtoFxn = NULL,
        },
    };
    
    uint32_t gFlashConfigNum = CONFIG_FLASH_NUM_INSTANCES;
    
    int32_t Board_flashOpen()
    {
        uint32_t instCnt;
        int32_t  status = SystemP_SUCCESS;
    
        /* Set the peripheral instance to use in the under lying flash implementation */
        gFlashConfig[CONFIG_FLASH0].attrs->driverInstance = CONFIG_OSPI0;
    
        for(instCnt = 0U; instCnt < CONFIG_FLASH_NUM_INSTANCES; instCnt++)
        {
            gFlashHandle[instCnt] = NULL;   /* Init to NULL so that we can exit gracefully */
        }
    
        /* Set the underlying driver instance to the FLASH config */
        gFlashAttrs_S25HL512T.driverInstance = CONFIG_OSPI0;
    
        /* Open all instances */
        for(instCnt = 0U; instCnt < CONFIG_FLASH_NUM_INSTANCES; instCnt++)
        {
    
            gFlashHandle[instCnt] = Flash_open(instCnt, &gFlashParams[instCnt]);
            if(NULL == gFlashHandle[instCnt])
            {
                DebugP_logError("FLASH open failed for instance %d !!!\r\n", instCnt);
                status = SystemP_FAILURE;
                break;
            }
        }
    
        if(SystemP_FAILURE == status)
        {
            Board_flashClose();   /* Exit gracefully */
        }
        return status;
    }
    
    void Board_flashClose(void)
    {
        uint32_t instCnt;
    
        /* Close all instances that are open */
        for(instCnt = 0U; instCnt < CONFIG_FLASH_NUM_INSTANCES; instCnt++)
        {
            if(gFlashHandle[instCnt] != NULL)
            {
                Flash_close(gFlashHandle[instCnt]);
                gFlashHandle[instCnt] = NULL;
            }
        }
        return;
    }
    
    

    Best,

    Larry

  • Hi Larry,

    Everything actually looking okay. I am not sure at the moment why `sbl_uart_uniflash` fails in 1s-1s-1s mode. If you could use CCS to connect to R5F core and see where the `sbl_uart_uniflash` is stuck, we can then figure out the issue.

    Anyways, if the `sbl_uart_uniflash` is working in 4s-4s-4s mode, you can continue using it. The flashing of SBL OSPI and application image and booting them are independent procedures. So, we can focus on the later part.

    Let me know if this sounds good.

    Regards,

    Prashant

  • Hi Prashant,

    I will attempt to use debug mode to identify the precise point of failure. However, while I use the 4s-4s-4s configuration in sbl_uart_uniflash, I utilize a 1s-1s-1s configuration in SBL_OSPI, resulting in a log stating "Some tests have failed!!". Could these different settings be causing this discrepancy?

    Best,

    Larry

  • Hi Larry,

    Could these different settings be causing this discrepancy?

    No, this is not possible. As I said, this flashing and booting are independent procedures. After flashing in UART bootmode, we power off the board which resets the board fully. Then changing the bootmode to OSPI, the board boots from the scratch.

    I utilize a 1s-1s-1s configuration in SBL_OSPI, resulting in a log stating "Some tests have failed!!"

    Could you please try the following change in the SBL OSPI

    Regards,

    Prashant

  • Hi Prashant,

    Thanks for your help, this work for me!

    Best,

    Larry