XMC4200 SPI Change SELO pins during program execution

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

cross mob
Not applicable
Hello,
I want to manage two Slave devices by means of SPI protocol with my XMC4200 as Master. These two devices are connected to P0.7 and P1.0, respectively. Both pins are availabre for SELO0 in the XMC4200.
In the Dave App I select P0.7 as SELO0. During the main program I want to change the SELO0 to the other pin P1.0 to manage both devices when I need.
I need help with the neccesary intructions to change the SELO0 pin P0.7 to P1.0 and viceversa.
Regards,

Victor
0 Likes
1 Reply
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Did you try something like below?

SPI_MASTER_EnableSlaveSelectSignal(&SPI_MASTER_0, SPI_MASTER_SS_SIGNAL_0);
SPI_MASTER_Transmit(&SPI_MASTER_0, data, DATA_LEN);
while(SPI_MASTER_0.runtime->tx_busy);
SPI_MASTER_DisableSlaveSelectSignal(&SPI_MASTER_0);

SPI_MASTER_EnableSlaveSelectSignal(&SPI_MASTER_0, SPI_MASTER_SS_SIGNAL_1);
SPI_MASTER_Transmit(&SPI_MASTER_0, data, DATA_LEN);
while(SPI_MASTER_0.runtime->tx_busy);
SPI_MASTER_DisableSlaveSelectSignal(&SPI_MASTER_0);

Regards,
Jesus
0 Likes