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.

AM62P: AM62P: IS25WX512M flash customize

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

Hi,
I am working on a customized flash IS25WX512M with AM62P. I have tried the Sysconfig configurations along with modified "flash_nor_ospi.c" provided by Vaibhav Kumar and I found it did not work. Currently, I have verified the feasibility of accessing flash under 1S mode. I set the uart_uniflash_sbl2 in flash 1S mode and the ospi_sbl1 is set in flash 8D mode so that I could debug sequentially in WKUP. I have already run the process above successfully.
When I debugging in function Flash_norOspiOpen, I found the flash ID could be read correctly but the volatile register which implies the selected flash protocol could not be read. The snipped code is attached below.
        /* Set device size and addressing bytes */
        OSPI_setDeviceSize(obj->ospiHandle, attrs->pageSize, attrs->blockSize);
        /* Set command opcode extension type */
        OSPI_setCmdExtType(obj->ospiHandle, config->devConfig->cmdExtType);
        /* Set initial number of address bytes */
        obj->numAddrBytes = 3;
        /* Set current protocol as 1s1s1s */
        obj->currentProtocol = FLASH_CFG_PROTO_1S_1S_1S;
        /* Now configure the flash for the selected protocol */
        status += Flash_norOspiSetProtocol(config, obj->ospiHandle, params);
        obj->currentProtocol = config->devConfig->protocolCfg.protocol;

        /* recheck the 8D mode reg */
        // read reg in 8D manner 
        uint8_t reg_8dflag_imme[3] = { 0 };
        status = Flash_norOspiCmdRead(config, 0x85, 0x00000000, 4, 7, reg_8dflag_imme, 4);
        /* read ID */
        uint8_t reg_id_imme[5] = { 0 };
        status = Flash_norOspiCmdRead(config, 0x9F, 0x00, 4, 7, reg_id_imme, 4); // dummy=7, result is aligned
You could notice that the parameters I seleted for Flash_norOspiCmdRead are cmdAddr=0x00 and dummyBits=7 because only this setting could ensure the flash ID could be read without any bit shifts. I have confirmed with FAE of flash manufacturer that the address of 8D mode reg is 0x00000000. Any ideas on how to fix this?
In addition to that, the FAE of flash manufacturer also mentioned the SoC is required to send double command frames to flash IS25WX512M under 8D mode. In other words, if the command is 0x8E, the command part sent by SoC should be 0x8E8E. I want to doublecheck whether this featute is supported by AM62P. If this feature is supported, how to enable it?
 
Regards,
Bomiao
 
  • Hello Bomiao

    Thank you for the query.

    Please expect delay in response due to local holiday.

    Regards,

    Sreenivasa

  • Hi,

    Wanna doublecheck the status of this thread.

    Regards,

    Bomiao 

  • In addition to that, the FAE of flash manufacturer also mentioned the SoC is required to send double command frames to flash IS25WX512M under 8D mode. In other words, if the command is 0x8E, the command part sent by SoC should be 0x8E8E. I want to doublecheck whether this featute is supported by AM62P. If this feature is supported, how to enable it?

    This is already taken care in the SysConfig > FLASH. There is a section which allows user to configure INVERSE, NONE and REPEAT, so you must have REPEAT already selected if not do so.

    Also tell me if you avoid putting the read logic inside the flash_norOspiOpen function, does your app work fine?

  • This is already taken care in the SysConfig > FLASH. There is a section which allows user to configure INVERSE, NONE and REPEAT, so you must have REPEAT already selected if not do so.

    Good to see there is a config option to ensure the double frame sending.

    Also tell me if you avoid putting the read logic inside the flash_norOspiOpen function, does your app work fine?

    No, the app cannot work normally. If I use original flash_norOspiOpen.c, I could not finish the flash driver init. That's the reason why I debug sequentially in flash_norOspiOpen(). 

    Regards,

    Bomiao

  • Hello Vaibhav,

    Thank you much for jumping in to support the thread.

    Thanks

    Best Regards,

    Anastas Yordanov

  • Hi Fan,

    Can you share me the MCU PLUS SDK version?

    Regards,

    Vaibhav

  • Hi Vaibhav,

    The MCU+SDK version is 11.01.01.08.

    Regards,

    Bomiao

  • Thanks.

    I would have you set these values for the flash to work.

    Screenshot for the SysConfig values:

    Here change the flash name to the one you are using.

    Change the flash size in bytes to 67108864

    Change the JEDEC Device ID to 5B1A

    In flash_nor_ospi.c, under the API Flash_norOspiReadId, make the following change:

    static int32_t Flash_norOspiReadId(Flash_Config *config)
    {
        int32_t status = SystemP_SUCCESS;
        Flash_NorOspiObject *obj = (Flash_NorOspiObject *)(config->object);
        Flash_DevConfig *devCfg = config->devConfig;
        FlashCfg_ReadIDConfig *idCfg = &(devCfg->idCfg);
    
        uint8_t  idCode[FLASH_OSPI_JEDEC_ID_SIZE_MAX];
        uint32_t cmdAddr = OSPI_CMD_INVALID_ADDR;
        uint32_t dummyBits = 0;
        uint32_t idNumBytes = 3;
        uint32_t numAddrBytes = 0;
    
        if(obj->currentProtocol == FLASH_CFG_PROTO_8D_8D_8D)
        {
            if (config->attrs->manufacturerId == 0x34)
            {
                dummyBits = 4;
                cmdAddr = 0;
                numAddrBytes = obj->numAddrBytes;
                idNumBytes = 4; /* Can't read odd bytes in octal DDR */
            }
            else
            {
                dummyBits = 8;
                cmdAddr = OSPI_CMD_INVALID_ADDR;
                numAddrBytes = obj->numAddrBytes;
                idNumBytes = 4; /* Can't read odd bytes in octal DDR */
            }
        }
        else
        {
            /* default config */
        }
    
        status = Flash_norOspiCmdRead(config, idCfg->cmd, cmdAddr, numAddrBytes, dummyBits, idCode, idNumBytes);
    
        /* Verify ID with filled data */
        if (status == SystemP_SUCCESS)
        {
            uint32_t manfID, devID;
    
            manfID = (uint32_t)idCode[0];
            devID = ((uint32_t)idCode[1] << 8) | ((uint32_t)idCode[2]);
            if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId)))
            {
                /* Try the other 3 bytes */
                manfID = (uint32_t)idCode[3];
                devID = ((uint32_t)idCode[4] << 8) | ((uint32_t)idCode[5]);
                if (!((manfID == config->attrs->manufacturerId) && (devID == config->attrs->deviceId)))
                {
                    status = SystemP_FAILURE;
                }
            }
            else
            {
                /* Success, nothing to do */;
            }
        }
    
        return status;
    }

    Once done, make sure to rebuild the libraries properly and then rebuild your application. 

    Let me know if it works.

  • Moreover, remove any customized modification you made in any of the APIs, but make sure to include the change I suggested in above response for the API Flash_norOspiReadId.