Hi all,
I'm having trouble figuring out the SPI for the 28035. I am trying to talk to a flash chip using master mode 0 but the signals output by the 28035 do not seem correct for mode 0. Below is a picture of what I see when I output 0x90 (channel 1 is clock and channel 2 is MOSI). For mode 0 I expect MOSI to be sampled on the rising clock edge but instead it is being sampled on the falling clock edge. Therefore the flash chip does not properly receive the 0x90 command.
Just for reference, this timing diagram is what I expect to see when setting up the 28035 for master mode 0 and outputting 0x90 (channel 2 being MOSI). I obtained this trace by putting the 28035 in mode 1, but then of course the flash chip won't return the correct data because it's expecting mode 0.
Here is my SPI initialization code:
SysCtrlRegs.PCLKCR0.bit.SPIAENCLK = 1;
/* disable the SPI-A interrupt */
SpiaRegs.SPICTL.bit.SPIINTENA = SPI_INT_DISABLE;
/* enable internal pull-ups on the SPI-A pins */
GpioCtrlRegs.GPAPUD.bit.GPIO3 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO5 = 0;
GpioCtrlRegs.GPAPUD.bit.GPIO18 = 0;
// GpioCtrlRegs.GPAQSEL1.bit.GPIO3 = 3;
// GpioCtrlRegs.GPAQSEL1.bit.GPIO5 = 3;
GpioCtrlRegs.GPAQSEL2.bit.GPIO18 = 3;
/* configure pins to provide SPI-A functionality */
GpioCtrlRegs.GPAMUX1.bit.GPIO3 = 2;
GpioCtrlRegs.GPAMUX1.bit.GPIO5 = 2;
GpioCtrlRegs.GPAMUX2.bit.GPIO18 = 1;
/* use mode 0 */
SpiaRegs.SPICCR.bit.CLKPOLARITY = 0;
SpiaRegs.SPICTL.bit.CLK_PHASE = 0;
/* enable transmit functionality */
SpiaRegs.SPICTL.bit.TALK = 1;
/* set 8 bit transfers and master mode */
SpiaRegs.SPICCR.bit.SPICHAR = SPI_CHAR_8_BITS;
SpiaRegs.SPICTL.bit.MASTER_SLAVE = SPI_MASTER;
/* use LSPCLK for the SPI-A frequency */
SpiaRegs.SPIBRR = 0;
/* release SPI A from reset */
SpiaRegs.SPICCR.bit.SPISWRESET = SPI_SW_RESET_RELEASE;
I've used SPI extensively but am totally stuck on this one. I would appreciate any help!!!! Thanks in advance!