SPI multiple slaves Relax Kit

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Not applicable
Hi

For a schoolproject I use a XMC4500 relax kit and I want to communicate with a FPGA over SPI.
I use the SPI001 [1.0.16] app from DAVE and it works great, the XMC4500 as master and the FPGA as slave.
But now I want to use 2 FPGA's, so I need to switch between 2 slaves. Therefor I want to use 2 chip select lines.
So I set number of chip select lines on 2. But if I want to write data, how do I set the right chip select line? Or how could I switch between the 2 chip select lines.

Or should I take an other SPI001_handle?
But then I couldn't assign the right pins to it, for the MTSR I only can choose between P2.5 and P3.5. and I could find these on the board.

What should I do?

Kind regards,
Jeroen
0 Likes
3 Replies
Not applicable
Hi Jeroen,

For the Apps configuration, just input "2" for "Number of Chip Select Lines" in "SPI001_Configuration" tab. Then you are able to do Manual Pin Assignment for ChipSelectA & B. In order to active the corresponding chip select lines, you need to write to PCR.SELO by yourself in main.c. Do have a try...

Best regards,
Zain
0 Likes
Not applicable
Hi,

I am working with the same kit. Now I connect two external DAC-Converter to the Relax Light Kit via SPI (SPI001 App).
So I generated an Interrupt where I send the new data to the converters. This works and the data is transmitted correct, but
always the CS A line is going down to ground while the data is transmitted...

My code:

int ERU_ISR(void){

SendData_3 |= Mask_A;
SPI001_WriteData(&SPI001_Handle0,&SendData_3,SPI001_STANDARD);

//Switch from CS A to CS B?

SendData_4 |= Mask_B;
SPI001_WriteData(&SPI001_Handle0,&SendData_4,SPI001_STANDARD);


return 0;
}
So the question is:
How can I easily switch the Chip Selct Lines?

Best regards,
misisp
0 Likes
Not applicable
Hi misisp,

Have you tried to set the frame length to the max. 64 and see the effect?

BR,
Zain
0 Likes