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.

TM4C129XNCZAD: SPI FLASH intefac

Part Number: TM4C129XNCZAD

Tool/software:

Dear Sir,

We are interfacing W25Q16JLUXIG_TR  16MB flash but not able to read device ID. Also not able to write to flash.

I am attaching the file for reference

// The SSI3 peripheral must be enabled for use.
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
//
ROM_GPIOPinConfigure(GPIO_PF0_SSI3XDAT1);
ROM_GPIOPinConfigure(GPIO_PF4_SSI3XDAT2);
ROM_GPIOPinConfigure(GPIO_PF5_SSI3XDAT3);

ROM_GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
ROM_GPIOPinConfigure(GPIO_PQ1_SSI3FSS); // Added.
ROM_GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
// ROM_GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_4 | GPIO_PIN_5);
ROM_GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_2 | GPIO_PIN_1 | GPIO_PIN_0); // Added.
ROM_GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_0); // Added..

void Flash_SPI_init(uint32_t ui32SysClock) {

uint32_t pui32Dummy[1];
uint32_t ui32DeviceID;
SSIConfigSetExpClk(SSI3_BASE, ui32SysClock, SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 1000000, 8);

// Enable the SSI3 module.
ROM_SSIAdvModeSet(SSI3_BASE, SSI_ADV_MODE_WRITE);
SSIAdvFrameHoldEnable(SSI3_BASE);
SSIEnable(SSI3_BASE);

while (SSIDataGetNonBlocking(SSI3_BASE, &pui32Dummy[0])) {
}

Delay(500000);

// First Read the DEVICE ID
ui32DeviceID = SSILibSendReadIDAdvMode(SSI3_BASE);

if (ui32DeviceID != DEVICE_ID) {

Delay(500000);

Delay(500000);


}

// UARTprintf("External Flash Detected with Device ID %x\n",ui32DeviceID);
}

uint32_t SSILibSendReadIDAdvMode(uint32_t ui32Base) {
uint32_t ui32Idx, ui32Receive;
uint32_t ui32MfgID;
uint32_t ui32DevID;
uint32_t ui32ReadID[] = { 0xaa, 0xaa };
uint32_t ui32ReadIDFlash;

for (ui32Idx = 0; ui32Idx < sizeof(g_ui8InstrReadID) / sizeof(g_ui8InstrReadID[0]); ui32Idx++) {
SSIDataPut(ui32Base, g_ui8InstrReadID[ui32Idx]);
}

SSIAdvModeSet(ui32Base, SSI_ADV_MODE_READ_WRITE);
SSIDataPut(ui32Base, 0x00);
SSIDataGet(ui32Base, &ui32Receive);
ui32ReadID[0] = ui32Receive;
SSIAdvDataPutFrameEnd(ui32Base, 0x00);
SSIDataGet(ui32Base, &ui32Receive);
ui32ReadID[1] = ui32Receive;
ui32MfgID = ui32ReadID[0];
ui32DevID = ui32ReadID[1];
ui32ReadIDFlash = ui32MfgID;

ui32ReadIDFlash = ui32ReadIDFlash << 8;
ui32ReadIDFlash |= ui32DevID;

SSIAdvModeSet(SSI3_BASE, SSI_ADV_MODE_WRITE);

return ui32ReadIDFlash;
}

Its 16MB but schemtic it is wrong show 512MB

  • Hi,

      I'm currently on vacation. I will look into your problem when I come back on Thursday. In the meantime, please show a scope cap or a logic analyzer capture of the SSI3 interface.

  • Hi,

      Do you have a scope cap or logic analyzer waveform for the SSI3 interface? Do the signals conform to the timing requirement for W25Q16JLUXIG_TR for reading the manufacture and device ID? Reading the W25Q16JLUXIG_TR datasheet, you need to use the serial (1-bit) mode, not quad mode. See below. You would need to send a 90h instruction followed by 24 bits of 0 and after which you can read out the manufacture ID (EFh) and the Device ID. In your code snippet for SSILibSendReadIDAdvMode, what is stored in g_ui8InstrReadID[]? Please check if g_ui8InstrReadID contains the 90h and three bytes of 0. Below is the sequence I expect:

     - Hold the CS/Frame signal low using SSIAdvFrameHoldEnable.

    - SSIAdvModeSet(ui32Base, SSI_ADV_MODE_READ_WRITE);

      - Call SSIDataPut() to send out 90h and five bytes of 0. The last two bytes are don't care but you need these two dummy bytes to create clocks to the slave for the manufacture ID and Device ID to return.

      - Call SSIDataGet to read the data from the RX FIFO. You need to mask out the upper bits. See SSIDataGet user's guide.