I'm seeing big gaps (5 us) between each byte in the transmission. What's the cause and how do I fix it?
Here's my init and transfer function, I'm using the latest CMSIS LPCOpen code. I pretty much lifted this from the example. I'm controlling the CS manually.
void int(void)
{
SPI_CFGSETUP_T spiSetup;
SPIM_DELAY_CONFIG_T masterDelay;
/* Initialize SPI controller */
Chip_SPI_Init(EVE_SPI); /* Call to initialize first SPI controller for mode0, master mode, MSB first */
Chip_SPI_Enable(EVE_SPI);
spiSetup.master = 1;
spiSetup.lsbFirst = 0;
spiSetup.mode = SPI_CLOCK_MODE0;
Chip_SPI_ConfigureSPI(EVE_SPI, &spiSetup);
/* Setup master controller SSELx for active low select */
Chip_SPI_SetCSPolLow(EVE_SPI, EVE_SSEL);
/* Setup master clock rate, but start off slow. */
Chip_SPIM_SetClockRate(EVE_SPI, 1000000);
/* Setup master delay (all chip selects) */
masterDelay.PreDelay = 0x00;
masterDelay.PostDelay = 0x00;
masterDelay.FrameDelay = 0x00; // This can be as low as zero, but set to two to making debugging easier w/ a scope.
masterDelay.TransferDelay = 0x01; // The minimum is 1.
Chip_SPIM_DelayConfig(EVE_SPI, &masterDelay);
}
/* Setup master transfer callbacks in the transfer descriptor */
spiMasterXfer.eventCB = NULL;
static void spi_transfer(uint8_t *data, size_t size)
{
/* Set up master transfer block */
spiMasterXfer.txData = data; /* set master transmit pointer */
spiMasterXfer.txCount = size; /* set master transmit frame count */
spiMasterXfer.rxData = data; /* set master receive pointer */
spiMasterXfer.rxCount = size; /* set master receive frame count */
spiMasterXfer.dataWidth = 8;
spiMasterXfer.sselNum = 0; /* set SPI select */
spiMasterXfer.txIndex = 0; /* clear the transmit buffer index */
spiMasterXfer.rxIndex = 0; /* clear the receive buffer index */
spiMasterXfer.option = 0;
Chip_SPIM_XferBlocking(EVE_SPI, &spiMasterXfer);
}