Jun 18, 2019
12:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 18, 2019
12:40 AM
Hi!
I'm using SPI on USIC0_CH1 of a xmc4800 144x196 chip and when i use the function XMC_SPI_CH_GetReceivedData(XMC_SPI0_CH1) i always get 0.
On the oscilloscope i see that both MISO and MOSI are carrying data, so why the read function gives 0?
Here there is my code
These are the pins i'm using for SPI:
P2.2 MISO
P3.5 MOSI
P2.4 SCLK
P2.3 CS
I'm using SPI on USIC0_CH1 of a xmc4800 144x196 chip and when i use the function XMC_SPI_CH_GetReceivedData(XMC_SPI0_CH1) i always get 0.
On the oscilloscope i see that both MISO and MOSI are carrying data, so why the read function gives 0?
Here there is my code
uint16_t frame_out = 0x5555;
uint16_t read = 0;
/*Enable Slave Select line 0*/
XMC_SPI_CH_EnableSlaveSelect(XMC_SPI0_CH1, XMC_SPI_CH_SLAVE_SELECT_0);
XMC_SPI_CH_Transmit(XMC_SPI0_CH1, frame_out, XMC_SPI_CH_MODE_STANDARD);
/*Wait till the byte has been transmitted*/
while((XMC_SPI_CH_GetStatusFlag(XMC_SPI0_CH1) & XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION) == 0U);
XMC_SPI_CH_ClearStatusFlag(XMC_SPI0_CH1, XMC_SPI_CH_STATUS_FLAG_TRANSMIT_SHIFT_INDICATION);
while((XMC_SPI_CH_GetStatusFlag(XMC_SPI0_CH1) & XMC_SPI_CH_STATUS_FLAG_ALTERNATIVE_RECEIVE_INDICATION) == 0U);
XMC_SPI_CH_ClearStatusFlag(XMC_SPI0_CH1, XMC_SPI_CH_STATUS_FLAG_RECEIVE_INDICATION);
read = XMC_SPI_CH_GetReceivedData(XMC_SPI0_CH1);
/*Disable Slave Select line */
XMC_SPI_CH_DisableSlaveSelect(XMC_SPI0_CH1);
These are the pins i'm using for SPI:
P2.2 MISO
P3.5 MOSI
P2.4 SCLK
P2.3 CS
- Tags:
- IFX
1 Reply
Jun 18, 2019
03:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 18, 2019
03:28 AM
I think that
First you need to invoke
XMC_SPI_CH_GetReceivedData
then
while(flags...).
First you need to invoke
XMC_SPI_CH_GetReceivedData
then
while(flags...).