Other Parts Discussed in Thread: SYSCONFIG
Tool/software:
Im using the spi_ex3_external_loopback example and modified it so that Im only transmitting 16 bytes of data on SPIB wit the SPISTE pin controlled manually. Here is the code:
//
// Included Files
//
#include "driverlib.h"
#include "device.h"
#include "board.h"
#include "f28003x_device.h"
//
//Macros
//
static inline void GPIO_SPI_FLASH_CS_CLEAR(void){
GpioDataRegs.GPACLEAR.bit.GPIO15 = 1;
}
static inline void GPIO_SPI_FLASH_CS_SET(void)
{
GpioDataRegs.GPASET.bit.GPIO15 = 1;
}
//
//Prototype
//
uint16_t spi_transmit_byte(uint16_t data_tx);
//
// Main
//
void main(void)
{
uint16_t i;
uint16_t TxData_SPIB[] = {0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F};
//
// Initialize device clock and peripherals
//
Device_init();
//
// Disable pin locks and enable internal pullups.
//
Device_initGPIO();
//
// Initialize PIE and clear PIE registers. Disables CPU interrupts.
//
Interrupt_initModule();
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
//
Interrupt_initVectorTable();
//
// Board initialization
//
Board_init();
//
// Loop forever. Suspend or place breakpoints to observe the buffers.
//
// for(i = 0; i < 16; i++)
// {
// spi_transmit_byte(TxData_SPIB[i]);
// }
spi_transmit_multi_byte(TxData_SPIB, 16);
//
// Loop forever
//
while(1);
}
uint16_t spi_transmit_byte(uint16_t data_tx)
{
uint16_t ret_val = 0U;
/* Shift the data to MSbyte as the 8bit setting discards the LSbyte and transmits only MSbyte
* Assert the CS low
* Transmit the data and dummy read
* Drive the CS high
*/
data_tx = data_tx << 8U;
GPIO_SPI_FLASH_CS_CLEAR();
SPI_writeDataNonBlocking(SPIB_BASE, data_tx);
SPI_readDataNonBlocking(SPIB_BASE);
GPIO_SPI_FLASH_CS_SET();
return ret_val;
}
uint16_t spi_transmit_multi_byte(uint16_t *buffer_tx, uint16_t len)
{
uint16_t i, data_tx;
uint16_t ret_val = 0U;
/* Shift each data to be sent to MSbyte as the 8bit setting discards the LSbyte and transmits only MSbyte
* Assert the CS low
* Transmit all the data while dummy reading at the same time
* Drive the CS high
*/
GPIO_SPI_FLASH_CS_CLEAR();
for (i = 0; i < len; i++)
{
data_tx = buffer_tx[i] << 8U;
SPI_writeDataNonBlocking(SPIB_BASE, data_tx);
SPI_readDataNonBlocking(SPIB_BASE);
}
GPIO_SPI_FLASH_CS_SET();
return ret_val;
}
Here is how the sysconfig looks like:

And here is what Im observing on the logic analyzer:

My question is what is happening with the GPIO used as SPISTE pin? Im expecting the pin to stay active low for the whole of for loop till the transmission is completed. What am I missing here?

