Quantcast
Channel: Infineon Forums
Viewing all articles
Browse latest Browse all 9892

XMC1100 SPI Problem

$
0
0
Hello,

I think there are 3 issues with the code:

1) P1_IOCR0 configuration:
- the bit field for P1.1 is being overwritten with the second write (for P1.2/3?). I think it is better to use "OR equals" instead.
- P1.2 is being configured for MOSI, but in the comments, P1.3 is mentioned.

2) TCSR configuration:
- SELMD bit is being set to 1. This enables the dynamic selection of SELO lines based on the TBUF[x] input location.
- In the subsequent code, you are using TBUF[0] which effectively clears PCR.SELO to 0.
- I will suggest to either disable the SELMD or write to TBUF[1].

3) TRBSR status
- I assume the actual transmission is taking place in the while loop, i.e. the write to TBUF outside of the while loop should be commented off.
- In the while loop, TRBSR is being checked for the status but this register is applicable only when TXFIFO is being used. From the code, I see that you are using the standard buffer instead (TBUF[x]).
- in this case, it is better to check for TCSR.TDV bit instead to know when the next transmit data can be written.
For example:
Code:

          USIC0_CH1->TBUF[1] = 0x4010;
          while((USIC0_CH1->TCSR & 0x80)>>7);

I hope this helps.

Regards,
Min Wei

Viewing all articles
Browse latest Browse all 9892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>