Hi,
I am seeing a real strange issue with my SPI tx data transfer. When calling the following function in main.c and observing the results on an oscilloscope, the function successfully executes and the data can be seen on the MISO line of the XMC4500.
The issue comes when I call the same function in a different source file. The status of the transmit is Success however, the code will then get stuck in the while loop.
void SPI_Write_Data (void)
{
uint16_t WriteData = 123;
if(SPI_MASTER_Transmit(&SPI_MASTER_0, &WriteData, sizeof(WriteData )) == SPI_MASTER_STATUS_SUCCESS)
{
while(SPI_MASTER_0.runtime->tx_busy)
{
}
}
}
I am using a XMC4500 with DAVE 4. I am using the SPI_Master app in full duplex mode with a desired baud rate of 1M.
The app is configured to interrupt mode, however no end of tx/rx callbacks. FIFO is enabled, with a size of 2 for both Rx and Tx.
I dug down further into the cause, to make sure the data is not still being transferred and the CS has returned to a high state, only to find that no data is even transferred.
The tx_busy flag is set to true, as part of the SPI_MASTER_Transmit API, though it is never set back to false.
When in the working instance, the tx_busy flag set to false and the data transferred in the XMC_USIC_CH_TriggerServiceRequest(handle->channel, (uint32_t)handle->config->tx_sr) function, with in the SPI_MASTER_Transmit API.
In the non-working instance, nothing appears to happen during the XMC_USIC_CH_TriggerServiceRequest(handle->channel, (uint32_t)handle->config->tx_sr) function call. The tx_busy flag remains set to true and no data transferred.
Does this mean some other interrupt is generated to set the flag back to false?
I have read about others having issues with SPI in passed posts and used many examples but nothing has yet to help me out.
I was hoping I could use some help from you guys with why/how the origin of a function call can change the way the function works, without anything being passed in!
Any ideas?
Thanks in advanced,
Steven