Hi All:
Now my board use TM4C1294ncpdt and connect a Macronix MX25L6406E serial flash via SSI2,
development environment is TI-rtos & NDK.
I've tested 2 sample code find in the e2e.
1.
e2e.ti.com/.../1145.TM4C129_5F00_SSI3_5F00_MacronixFlash.7z
This file used SSI3 and tivaware code, after I modify to SSI2, this program can work normally.
2.
processors.wiki.ti.com/.../TI-RTOS_Examples_SerialFlash
This code used TI-RTOS & SSI2 interface, When I try to modify to MX25L6406E command, this program can't work. I can find CS, SCLK and
MOSI signal, but can't find SIMO signal via Oscilloscope.
I'm confused about two point about TI-RTOS_Examples_SerialFlash project. Below is my partial code.
unsigned char MX6406E_readREMS(AT45DB_Handle handle) { SPI_Transaction spiTransaction; unsigned char txBuffer[5]; volatile unsigned char status[5]; IArg key; /* Initialize master SPI transaction structure */ txBuffer[0]=0x90; txBuffer[1]=0x0; txBuffer[2]=0x0; txBuffer[3]=0x0; spiTransaction.count = 4; spiTransaction.txBuf = txBuffer; spiTransaction.rxBuf = NULL; key = GateMutex_enter(GateMutex_handle(&(handle->gate))); /* Initiate SPI transfer */ GPIO_write(handle->gpioCS, PIN_LOW); if (!SPI_transfer(handle->spiHandle, &spiTransaction)) { Log_print1(Diags_USER1, "Unsuccessful SPI opcode transfer", NULL); System_printf("Unsuccessful SPI opcode transfer"); } status[0]=1; status[1]=1; /* Get status */ spiTransaction.count = 2; spiTransaction.txBuf = NULL; spiTransaction.rxBuf = (Ptr)&status; if (!SPI_transfer(handle->spiHandle, &spiTransaction)) { Log_print1(Diags_USER1, "Unsuccessful SPI data transfer", NULL); System_printf("Unsuccessful SPI data transfer"); } System_printf("Joey recv (%d %d)", status[0], status[1]); System_flush(); GPIO_write(handle->gpioCS, PIN_HIGH); GateMutex_leave(GateMutex_handle(&(handle->gate)), key); return (status); }
a. The code used three SPI_transfer, I think one is for MOSI, other is for SIMO, I'm not sure that's a right method to transfer SPI?
b. Sample code use
GPIO_write(handle->gpioCS, PIN_LOW);
GPIO_write(handle->gpioCS, PIN_HIGH);
Why I need set this GPIO?
c. Why I can't get SIMO signal, and can you give me some suggestions to modify the program?
I don't have more experience to control SPI via TI-rtos and hope you can give me some suggestions.
Thank you very much!
Best Regards,
Joey