Hi,
I am trying to use the SPI peripheral of the C2000 launchpad, with limited success. After reading the relvant documentaion for the SPI module, I am initializing my module as
follows for a master transmitting 8-bits at 1MHz:
CLK_enableSpiaClock(myClk);
SPI_reset(nrf8001Spi);
SPI_setCharLength(nrf8001Spi,SPI_CharLength_8_Bits);
SPI_setMode(nrf8001Spi,SPI_Mode_Master);
SPI_enableTx(nrf8001Spi);
SPI_enableInt(nrf8001Spi);
SPI_setBaudRate(nrf8001Spi,SPI_BaudRate_1_MBaud);
SPI_setClkPhase(nrf8001Spi,SPI_ClkPhase_Normal);
SPI_setClkPolarity(nrf8001Spi,SPI_ClkPolarity_OutputRisingEdge_InputFallingEdge);
SPI_disableTxFifo(nrf8001Spi);
SPI_enableChannels(nrf8001Spi);
SPI_setPriority(nrf8001Spi, SPI_Priority_FreeRun);
SPI_enable(nrf8001Spi);
PIE_enableInt(myPie,PIE_GroupNumber_6,PIE_InterruptSource_SPIARX);
I then try to transmit 3 bytes, but what I see in the logic analyzer are 8 correct clock transitions, with the right data on MOSI, followed by 1 or 2 clock transitions with no data.
SpiaRegs.SPICTL.bit.TALK = 1; // Enable Transmit path
SpiaRegs.SPITXBUF = 0x06 << 8; // Master transmits data
while(SpiaRegs.SPISTS.bit.INT_FLAG !=1) {} // Waits until data rx’d
SpiaRegs.SPITXBUF = 0x0B << 8; // Master transmits data
while(SpiaRegs.SPISTS.bit.INT_FLAG !=1) {} // Waits until data rx’d
SpiaRegs.SPITXBUF = 0xAB << 8; // Master transmits data
while(SpiaRegs.SPISTS.bit.INT_FLAG !=1) {} // Waits until data rx’d
I expect to see a total of 24 clock transitions. Is there a missing setting or errata issue?
Thank you.