-
1. Re: SPI (SPIM_PutArray())
JoMe_264151 Jun 12, 2019 6:45 AM (in response to DaCh_4286001)Are there any thing I miss here?
Yes, you are too fast. The PutArray() API is non-blocking when the transmit buffer is large enough. So your reading GetTxBufferSize() just shows that the complete transfer to the slave is not done yet.
Bob
-
2. Re: SPI (SPIM_PutArray())
DaCh_4286001 Jun 12, 2019 6:58 AM (in response to JoMe_264151)So for the putArray(), it will put data on tx buffer and send data automatically to slave? I thought it will keep the data in buffer
-
3. Re: SPI (SPIM_PutArray())
VisonZ_71Jun 18, 2019 11:04 PM (in response to DaCh_4286001)
void SPIM_1_PutArray(const uint8 buffer[], uint8 byteCount)
{
uint8 bufIndex;
bufIndex = 0u;
while(byteCount > 0u)
{
/* Wait until TX FIFO has a place */
while(0u == (SPIM_1_TX_STATUS_REG & SPIM_1_STS_TX_FIFO_NOT_FULL))
{
}
/* Put data element into the TX FIFO */
CY_SET_REG8(SPIM_1_TXDATA_PTR, txData);
bufIndex++;
byteCount--;
}
}