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.

AM5728: QSPI issue in quad mode

Part Number: AM5728

Hello.

I am working on a project were we are using the evmam5728 as reference design, and we have conencted a QSPI flash. We want to use QSPI flash for booting.

I am testing the QSPI_BasicExample_idkAM572x_armTestProject. When using Rx Lines: single and dual, the test works fine (in mmap mode). it also works fine for Rx Lines: single and cfg mode. However, when using quad mode, the output  when reading from the flash is only CCCC... (1100110011001100...)

We have used the evmam5728 pinmux as reference, and added QSPI flash, the same way as in the idk board.

I would be happy for any suggestions on how to debug further.

Thanks to the TI community for your continuous support,

Anders.

  • The RTOS team have been notified. They will respond here.
  • Anders,

    You should use the pinmux for idkAM52x as reference for your implementation. Are you linking to the correct board library when running the project.
    Note that the cfg file for the example project you are using links to the idkAM572x board library so unless you changed the pinmux files in the board library and rebuilt board library as well as the app, the changes will not take effect. I would specifically look at pinmux for the TX lines.

    Also if you havee written to the QSPI flash, then we recommend that you erase the data before performing any new read writes as the flash device usually has the requirement to erase flash sectors before doing new writes.

    Regards.
    Rahul
  • Rahul,

    Thanks for your response.

    I have now used the idkAM572x as reference for my implementation. I have also tried to use the idkAM572x files without changing any of them. (the QSPI part of the board is conencted the same way as the idk board).

    I still get the same result when reading back the data from the flash (CCCC == 1100110011001100).

    After some debugging, I found out (at least I think so) that I am not able to set the QUAD bit in the configuration register. This bit is supposed to put the device into quad I/O operations. this is done in function bool S25FLFlash_QuadModeEnable(S25FL_Handle flashHandle) in file C:\ti\pdk_am57xx_1_0_8\packages\ti\drv\spi\test\qspi_flash\src\Flash_S25FL\S25FL.c.

    The code I am using for writing to the register, and reading back, is (in file S25FL.c):

    /* Read command register */
    writeVal = QSPI_LIB_CMD_QUAD_RD_CMD_REG;
    transaction.txBuf = (unsigned char *)&writeVal;
    transaction.rxBuf = NULL;
    transaction.count = 1;

    transferType = SPI_TRANSACTION_TYPE_WRITE;
    SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);

    retVal = SPI_transfer(handle, &transaction);

    transaction.txBuf = NULL;
    transaction.rxBuf = (unsigned char *)&configReg;
    transaction.count = 1;

    transferType = SPI_TRANSACTION_TYPE_READ;
    SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);

    retVal = SPI_transfer(handle, &transaction);

    SPI_log(" *** Configuration Register (from flash retVal == %d) %u\t0x%08X\t", retVal, configReg, configReg);
    SPI_log_bits(sizeof(configReg), &configReg);
    SPI_log("\n");

    /* Set 2nd bit of configuration register to 1 to enable quad mode */
    configReg |= (QSPI_FLASH_QUAD_ENABLE_VALUE << QSPI_FLASH_QUAD_ENABLE_BIT);
    data = (QSPI_LIB_CMD_WRITE_STATUS_REG << 16) | ((0xff & norStatus) << 8) | (0xFF & configReg);

    SPI_log(" *** Configuration Register (to be written to flash) %u\t0x%08X\t", configReg, configReg);
    SPI_log_bits(sizeof(configReg), &configReg);
    SPI_log("\n");

    /* Set transfer length in bytes */
    frmLength = 1;
    SPI_control(handle, SPI_V1_CMD_SETFRAMELENGTH, (void *)&frmLength);


    transaction.txBuf = (unsigned char *)&data;
    transaction.rxBuf = NULL;
    transaction.count = 3;

    transferType = SPI_TRANSACTION_TYPE_WRITE;
    SPI_control(handle, SPI_V1_CMD_TRANSFERMODE_RW, (void *)&transferType);

    retVal = SPI_transfer(handle, &transaction);

    When reading the configuration register, the QUAD bit is set to 0 (default value). I am able to read other registers in the QSPI flash.

    Appreciate your help,

    Anders.