XMC4500 + Multiple Slave's, chip selects are working only on one.

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

cross mob
Not applicable
Hello Forum,

I am new to Infineon, so please excuse me if I'm totally lame on terminology and understanding.

I have a XMC 4500 (LQFP144 package) v2.1.4.

Here are the pins I have configured for my SPI_1 bus.


P0.4 MISO
P0.5 MOSI
P5.8 SCK
P0.6 CS0
P5.9 CS1
P0.14 CS2
P5.11 CS3

here is how I set them up.. (In Keil)

XMC_SPI_CH_CONFIG_t spi_config =
{
.baudrate = 1000000,
.bus_mode = XMC_SPI_CH_BUS_MODE_MASTER,
.selo_inversion = XMC_SPI_CH_SLAVE_SEL_INV_TO_MSLS,
.parity_mode = XMC_USIC_CH_PARITY_MODE_NONE
};



XMC_SPI_CH_Init(XMC_SPI1_CH0, &spi_config);



XMC_SPI_CH_SetInputSource(XMC_SPI1_CH0,XMC_SPI_CH_INPUT_DIN0,USIC1_C0_DX0_P0_4);
XMC_SPI_CH_ConfigureShiftClockOutput(XMC_SPI1_CH0,XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_1_DELAY_DISABLED,XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK);


XMC_SPI_CH_Start(XMC_SPI1_CH0);

/*GPIO configuration*/
XMC_GPIO_SetMode(SPI_MOSI, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
XMC_GPIO_SetMode(SPI_SCLK, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
XMC_GPIO_SetMode(SPI_MISO, XMC_GPIO_MODE_INPUT_TRISTATE);

/*
* Configure all the chip selects
*/
XMC_GPIO_SetMode(MYCS0, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
XMC_GPIO_SetMode(MYCS1, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
XMC_GPIO_SetMode(MYCS2, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);
XMC_GPIO_SetMode(MYCS3, XMC_GPIO_MODE_OUTPUT_PUSH_PULL_ALT2);


And then when I go to send data....


/*Enable Slave Select line 1*/
XMC_SPI_CH_EnableSlaveSelect(XMC_SPI1_CH0, XMC_SPI_CH_SLAVE_SELECT_1);

This all works fine and dandy for XMC_SPI_CH_SLAVE_SELECT_1, but if I try any other CS, it doesn't seem to pull that CS Low.

Any ideas on what I'm setting up wrong? Or do I not understand how this USIC work?

Thanks in advance.
-stv
0 Likes
1 Reply
DRubeša
Employee
Employee
First solution authored First like received
Hi,

so I just notice that you´re using wrong pins 🙂 For CS0 you can use P0.6 OR P5.9, for CS1 P0.14 OR P5.11, for CS2 P0.15, and finally for CS3 P3.14. I haven´t come up with these pins straight from my head so you can consult (as I have done) XMC Pinout tool. Of course, you can see which pins are available under datasheet or you can even use DAVE´s Pin Mapping utility. This figure comes from XMC Pinout Tool:

2369.attach

Try to change the pin definition and see if you´re able to use the additional slave lines.

Best regards,
Deni
0 Likes