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.

AM2612: AM261 with customer OSPI Flash

Part Number: AM2612
Other Parts Discussed in Thread: SYSCONFIG

Hi,

I am using a MX25LM51245GXDI00 on a custom AM261 board, this flash is working fine in 1S-1S-1S mode, however in 8D-8D-8D I cannot get it to work. 

With ospi_flash_diag_am261x, a flash configuration was created, see attached file, this is used and loaded into syscfg. flash_config.json.txt 

Now when running ospi_flash_io_am261x, it fails at Board_flashOpen, debugging further shows, that  Flash_norOspiSetRdDataCaptureDelay does return SystemP_FAILURE.

Any ideas what can causes this and how to debug further?

Best regards,

Steffen

 

 

  • Hi Steffen,

    Can you please share the datasheet of the flash part that you are using. I got this one from internet. 
    https://www.macronix.com/Lists/Datasheet/Attachments/8729/MX25LM51245G,%203V,%20512Mb,%20v1.1.pdf
    Just wanted to confirm if this is correct.

    Regards,

    Aswin

  • Hi Aswin,

    this is the same one I have.

    Best regards,

    Steffen

  • Hi Steffen,

    Let me check this. I will get back to you in 1 day.

    Regards,

    Aswin

  • Hi Steffen,

    - Since this a flash configuration issue , to fix flash configurations we shall try with ospi_flash _io example.

    - From the logs that you have shared. I can see that Board_flashOpen as failed. Can you please attach the exact log. I assume it looks like the one I have written below


    ERROR: Board_flashOpen:205: FLASH open failed for instance 0 !!!
    ASSERT: 0.3985s: ../ospi_flash_io.c:ospi_flash_io_main:64: status==SystemP_SUCCESS failed !!!


    
    

    - This means that there is some issue with the "JEDEC ID Read Configuration" of flash configuration in sysconfig.

    - Can you make the above option in sysconfig as 8. This corresponds to dummy8 option in the diagnostics result.

    - Once this change is made, can you please run the ospi_flash_io example. And see the logs. This time it is expected for Board_flashOpen to not fail.

    - Now on running the test, if you are seeing that the data comparison has resulted in a mismatch, then can you please make the supported addressing modes option as 2. This corresponds to addrByteSupport in the diagnostic result.

    The above mentioned settings are for 8d-8d-8d mode only.

    Regards,

    Aswin

  • Hi Aswin,

    now I have changed the protocol to 8D-8D-8D, set Number Of Dummy Cycles In Octal Mode to 8, compiled and run again.

    This gives this error:

    ASSERT: 0.4595s: ../ospi_flash_io.c:ospi_flash_io_main:64: status==SystemP_SUCCESS failed !!!

    Best regards,

    Steffen

  • Hi Steffen,

    Can you please share me this file: syscfg/ti_board_open_close.c

    Regards,

    Aswin

  • Hi Steffen,

    Allow me to check this and getback to you

    Regards,

    Aswin

  • Hi Steffen,

    Can you please run ospi_flash_io example configured in 8D-8D-8D mode with this configuration.

     

    {
            "flashSize": 67108864,
            "flashPageSize": 256,
            "flashManfId": "0xC2",
            "flashDeviceId": "0x853A",
            "flashBlockSize": 65536,
            "flashSectorSize": 4096,
            "cmdBlockErase3B": "0xD8",
            "cmdBlockErase4B": "0xDC",
            "cmdSectorErase3B": "0x20",
            "cmdSectorErase4B": "0x21",
            "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": "0xFF",
                            "cmdWr": "0x02",
                            "modeClksCmd": 0,
                            "modeClksRd": 0,
                            "dummyClksCmd": 0,
                            "dummyClksRd": 0,
                            "enableType": "0",
                            "enableSeq": "0x00",
                            "dummyCfg": null,
                            "protoCfg": null,
                            "strDtrCfg": null
                    },
                    "p114": {
                            "isDtr": false,
                            "cmdRd": "0xFF",
                            "cmdWr": "0x02",
                            "modeClksCmd": 0,
                            "modeClksRd": 0,
                            "dummyClksCmd": 0,
                            "dummyClksRd": 0,
                            "enableType": "0",
                            "enableSeq": "0x00",
                            "dummyCfg": null,
                            "protoCfg": null,
                            "strDtrCfg": null
                    },
                    "p118": null,
                    "p444s": null,
                    "p444d": null,
                    "p888s": null,
                    "p888d": {
                            "isDtr": true,
                            "cmdRd": "0xEE",
                            "cmdWr": "0x12",
                            "modeClksCmd": 0,
                            "modeClksRd": 0,
                            "dummyClksCmd": 4,
                            "dummyClksRd": 14,
                            "enableType": "0",
                            "enableSeq": "0x04",
                            "dummyCfg": {
                                    "isAddrReg": true,
                                    "cmdRegRd":"0x71",
                                    "cmdRegWr":"0x72",
                                    "cfgReg":"0x00000003",
                                    "shift":0,
                                    "mask":"0x01",
                                    "bitP":3
                            },
                            "protoCfg": {
                                    "isAddrReg": true,
                                    "cmdRegRd": "0x71",
                                    "cmdRegWr": "0x72",
                                    "cfgReg": "0x00000001",
                                    "shift": 0,
                                    "mask": "0x01",
                                    "bitP": 0
                            },
                            "strDtrCfg": {
                                    "isAddrReg": true,
                                    "cmdRegRd": "0x71",
                                    "cmdRegWr": "0x72",
                                    "cfgReg": "0x00000003",
                                    "shift": 1,
                                    "mask": "0x03",
                                    "bitP": 1
                            }
                    },
                    "pCustom": {
                            "fxn": null
                    }
            },
            "addrByteSupport": "1",
            "fourByteAddrEnSeq": "0xB7",
            "cmdExtType": "INVERSE",
            "resetType": "0x10",
            "deviceBusyType": "1",
            "cmdWren": "0x06",
            "cmdRdsr": "0x05",
            "srWip":  0,
            "srWel":  1,
            "cmdChipErase": "0xC7",
            "rdIdSettings": {
                    "cmd": "0x9F",
                    "numBytes": 5,
                    "dummy4": 0,
                    "dummy8": 0
            },
            "xspiWipRdCmd": "0x05",
            "xspiWipReg": "0x00000000",
            "xspiWipBit": 0,
            "flashDeviceBusyTimeout": 192000000,
            "flashPageProgTimeout": 152
    }
    

    Regards,

    Aswin

  • Hi Aswin,

    still the same

    ERROR: Board_flashOpen:214: FLASH open failed for instance 0 !!!
    ASSERT: 0.4715s: ../ospi_flash_io.c:ospi_flash_io_main:64: status==SystemP_SUCCESS failed !!!

  • Hi Steffen,

    /*
     *  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_mx_flash;
    
    /* FLASH Driver handles - opened during Board_flashOpen() */
    Flash_Handle gFlashHandle[CONFIG_FLASH_NUM_INSTANCES];
    
    /* FLASH Attrs */
    Flash_Attrs gFlashAttrs_mx_flash =
    {
        .flashName = "mx_flash",
        .deviceId = 0x8639,
        .manufacturerId = 0xC2,
        .flashSize = 33554432,
        .blockCount = 512,
        .blockSize = 65536,
        .pageCount = 256,
        .pageSize = 256,
        .sectorCount = 8192,
        .sectorSize = 4096,
        .phyTuningOffset = 0x80000,
    };
    
    /* FLASH DevConfig */
    Flash_DevConfig gFlashDevCfg_mx_flash =
    {
        .cmdExtType = OSPI_CMD_EXT_TYPE_INVERSE,
        .enable4BAddr = TRUE,
        .addrByteSupport = 2,
        .fourByteAddrEnSeq = 0x20,
        .cmdWren = 0x06,
        .cmdRdsr = 0x05,
        .srWip = (1 << 0),
        .srWel = (1 << 1),
        .xspiWipRdCmd = 0x05,
        .xspiWipReg = 0x00000000,
        .xspiWipBit = (1 << 0),
        .resetType = 0x10,
        .eraseCfg = {
            .blockSize = 65536,
            .sectorSize = 4096,
            .cmdBlockErase3B = 0xD8,
            .cmdBlockErase4B = 0xDC,
            .cmdSectorErase3B = 0x20,
            .cmdSectorErase4B = 0x21,
            .cmdChipErase = 0xC7,
        },
        .idCfg = {
            .cmd = 0x9F, /* Constant */
            .numBytes = 5,
            .dummy4 = 0,
            .dummy8 = 0,
            .addrSize = 0
        },
        .protocolCfg = {
            .protocol = FLASH_CFG_PROTO_8D_8D_8D,
            .isDtr = TRUE,
            .cmdRd = 0xEE,
            .cmdWr = 0x12,
            .modeClksCmd = 0,
            .modeClksRd = 0,
            .dummyClksCmd = 20,
            .dummyClksRd = 20,
            .enableType = 0,
            .enableSeq = 0x04,
            .protoCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000001,
                .shift = 0,
                .mask = 0x01,
                .cfgRegBitP = 0,
            },
            .strDtrCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000000,
                .shift = 1,
                .mask = 0x00,
                .cfgRegBitP = 1,
            },
            .dummyCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000003,
                .shift = 1,
                .mask = 0x03,
                .cfgRegBitP = 1,
            },
        },
        .flashWriteTimeout = 152,
        .flashBusyTimeout = 76000000,
    };
    
    /* FLASH Config */
    Flash_Config gFlashConfig[CONFIG_FLASH_NUM_INSTANCES] =
    {
        {
            .attrs = &gFlashAttrs_mx_flash,
            .fxns = &gFlashNorOspiFxns,
            .skipHwInit = FALSE,
            .devConfig = &gFlashDevCfg_mx_flash,
            .object = (void *)&gFlashObject_mx_flash,
            .rwOffset = 0,
        },
    };
    
    /* 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_mx_flash.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;
    }
    

    This is the flash configuration which is working for a similar flash to that of you (MX25LW). Can you please align the flash configuration on your end based on this. 

    Please check

    1. idCfg

    2. protocolCfg

        a. protoCfg

        b. strDtrCfg

       c. dummyCfg

    Other configurations like device id, manf id should be the one that you already have.

    The background is that, I provided the same file to a different customer who uses the same flash part. They aligned their flash configurations based on this and was able to get it working.

    Can you please try it at your end?

    Regards,
    Aswin

  • Hi Aswin,

    thanks, this is interesting. I modified my file accordingly, which is not that straight forward, as some things cannot be changed through syscfg and you have to take care, that it is not overwritten.

    Especially

            .numBytes = 5,

    in the idCfg part is hard coded in the file used by syscfg to generate the C file.

    However it is still not working, I debugged it further and it is running into a timeout when switching to 888 mode, as the ready bit of the flash never gets set:

    This could also be a hardware problem, as this is a custom PCB and can have either a layout error or a assembly error. I think it is time to check this as well, unless you have further ideas.

    Best regards,

    Steffen

  • Hi Steffen,

    Thank you for trying this out. Apologies for asking again, can please share the ti_board_open_close.c file at this point. 
    If you had some trouble editing this file, then what can be done is that

    1. Copy the file contents and save it as ti_board_open_close.c file

    2. Then inside sysconfig, disable the generation of this file.

    Hope the above method makes the process easier.

    Thanks & Regards,

    Aswin

  • Hi Aswin,

    of course I can share the file:

    /cfs-file/__key/communityserver-discussions-components-files/908/7484.ti_5F00_board_5F00_open_5F00_close.c

    Thanks for the idea, I forgot about this option...

    Best regards,

    Steffen

  • Hi Steffen,

    Can you please use this configuration. You should be able to atleast read the device id using this configuration.

    /*
     *  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();
        }
        if(status==SystemP_SUCCESS)
        {
            status = Board_ioexpOpen();
            if(status == SystemP_FAILURE)
            {
                DebugP_log("IO Expander Configuration Failed!!\r\n");
            }
        }
    
    
        return status;
    }
    
    void Board_driversClose(void)
    {
    
        Board_flashClose();
    }
    
    /*
     * FLASH
     */
    /* FLASH Object - initialized during Flash_open() */
    Flash_NorOspiObject gFlashObject_MX25LM51245GXDI00;
    
    /* FLASH Driver handles - opened during Board_flashOpen() */
    Flash_Handle gFlashHandle[CONFIG_FLASH_NUM_INSTANCES];
    
    /* FLASH Attrs */
    Flash_Attrs gFlashAttrs_MX25LM51245GXDI00 =
    {
        .flashName = "MX25LM51245GXDI00",
        .deviceId = 0x853A,
        .manufacturerId = 0xC2,
        .flashSize = 67108864,
        .blockCount = 1024,
        .blockSize = 65536,
        .pageCount = 256,
        .pageSize = 256,
        .sectorCount = 16384,
        .sectorSize = 4096,
        .phyTuningOffset = 0x80000,
    };
    
    /* FLASH DevConfig */
    Flash_DevConfig gFlashDevCfg_MX25LM51245GXDI00 =
    {
        .cmdExtType = OSPI_CMD_EXT_TYPE_INVERSE,
        .enable4BAddr = TRUE,
        .addrByteSupport = 2,
        .fourByteAddrEnSeq = 0x20,
        .cmdWren = 0x06,
        .cmdRdsr = 0x05,
        .srWip = (1 << 0),
        .srWel = (1 << 1),
        .xspiWipRdCmd = 0x05,
        .xspiWipReg = 0x00000000,
        .xspiWipBit = (1 << 0),
        .resetType = 0x10,
        .eraseCfg = {
            .blockSize = 65536,
            .sectorSize = 4096,
            .cmdBlockErase3B = 0xD8,
            .cmdBlockErase4B = 0xDC,
            .cmdSectorErase3B = 0x20,
            .cmdSectorErase4B = 0x21,
            .cmdChipErase = 0xC7,
        },
        .idCfg = {
            .cmd = 0x9F, /* Constant */
            .numBytes = 3,
            .dummy4 = 0,
            .dummy8 = 20,
            .addrSize = 0
        },
        .protocolCfg = {
            .protocol = FLASH_CFG_PROTO_8D_8D_8D,
            .isDtr = TRUE,
            .cmdRd = 0xEE,
            .cmdWr = 0x12,
            .modeClksCmd = 0,
            .modeClksRd = 0,
            .dummyClksCmd = 20,
            .dummyClksRd = 20,
            .enableType = 0,
            .enableSeq = 0x04,
            .protoCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000000,
                .shift = 0,
                .mask = 0x00,
                .cfgRegBitP = 0,
            },
            .strDtrCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000000,
                .shift = 1,
                .mask = 0x00,
                .cfgRegBitP = 1,
            },
            .dummyCfg = {
                .isAddrReg = TRUE,
                .cmdRegRd = 0x71,
                .cmdRegWr = 0x72,
                .cfgReg = 0x00000003,
                .shift = 0,
                .mask = 0x01,
                .cfgRegBitP = 3,
            },
        },
        .flashWriteTimeout = 152,
        .flashBusyTimeout = 76000000,
    };
    
    /* FLASH Config */
    Flash_Config gFlashConfig[CONFIG_FLASH_NUM_INSTANCES] =
    {
        {
            .attrs = &gFlashAttrs_MX25LM51245GXDI00,
            .fxns = &gFlashNorOspiFxns,
            .skipHwInit = FALSE,
            .devConfig = &gFlashDevCfg_MX25LM51245GXDI00,
            .object = (void *)&gFlashObject_MX25LM51245GXDI00,
            .rwOffset = 0,
        },
    };
    
    /* 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_MX25LM51245GXDI00.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;
    }
    /*
     * IOEXP
     */
    int32_t Board_ioexpOpen()
    {
        int32_t  status = SystemP_SUCCESS;
        static TCA6408_Config  gTCA6408_Config;
        TCA6408_Params      TCA6408Params;
        TCA6408_Params_init(&TCA6408Params);
    
        TCA6408Params.i2cInstance  =  CONFIG_I2C0;
        TCA6408Params.i2cAddress  = 0x20U;
        status = TCA6408_open(&gTCA6408_Config, &TCA6408Params);
    
    
    
        if(SystemP_FAILURE == status)
        {
            /* Exit gracefully */
        }
    
        return status;
    }
    
    

    Regards,
    Aswin

  • This looks really promising! 

    I can get past flash_open and it is reading and writing data. The data read back does not match the data that is written. I think I have read about this somewhere already.

  • Hi Aswin,

    when I enable PHY mode, it is working. Even at an input clock divider of 2. So thanks for your help!

    All tests have passed!!

    Best regards,

    Steffen

  • Hi Steffen, 

    Glad to know that it worked. Issue that you faced might be because of clock config without PHY enablement. If OPSI needs to work at a high clock speed, then PHY should be enabled.


    Can you please share the sysconfig file which has this working ospi and flash configurations? 

    Thanks & Regards,

    Aswin

  • Thank you Steffen for providing the sysconfig file