---
title: "W7500 SPI Slave Chip Select"
url: "https://maker.wiznet.io/forum/15257"
markdown_url: "https://maker.wiznet.io/forum/15257/md"
type: "Forum topic"
category: "MCU & Boards"
author: "johannes4linux"
created: "2024-08-05T19:46:30+09:00"
last_activity: "2024-08-06T07:13:42+09:00"
language: "en"
views: 21
replies: 1
source: "WIZnet Makers forum (https://maker.wiznet.io/forum/)"
---

# W7500 SPI Slave Chip Select

## Question

Asked by johannes4linux on 2024-08-05 in MCU & Boards.

Hi forum,

I want to use SSP0 in SPI slave mode on a W7500 and I noticed a strange behavior. It seems after transferring DSS Bits (8 Bits in my example), you have to toggle the Chip Select Pin (SSEL0) otherwise the other bits are not read into the RX Fifo.

Attached you can find a minimal example I run on a WIZwiki-W7500ECO. I am configuring SPP0 as SPI slave and SPP1 as SPI master. The SPI Pins are connected together (PB5&lt;->PB15, PB6&lt;->PB16, PB7&lt;->PB17, PB8&lt;->PB18). I fill the master’s TX Fifo with 8 Bytes but my slave only receives the first on in its RX Fifo.

[w7500-spi-test.zip](https://maker.wiznet.io/forum/legacyFile.asp?path=tRSit3QIHM4MMBrM5eWR15Y6b95.zip) (105,2 KB)

Here is my SPI configuration:

```
	/* SPI configuration */
	SSP_StructInit(&SSPx_InitStructure);
	SSPx_InitStructure.SSP_DataSize = SSP_DataSize_8b;
	SSPx_InitStructure.SSP_Mode  = SSP_Mode_Slave;
	SSP_Init(SSP0, &SSPx_InitStructure);
```

Here is the UART output:

```
Sending 8 Bytes... Done!
SSP0->SR: 0x00000007

You sent 1 bytes to me.
vals[0] = 00000022
```

How do I have to configure my SSP0, so the Chip Select can be low for multiple byte transfers? Can you please help me here?

Best regards,
Johannes

## Replies

### Reply 1 by johannes4linux, 2024-08-06

Ok, I found the fix. The following [issue in the pico-sdk](https://github.com/raspberrypi/pico-sdk/issues/88) pointed me in the right direction and [here](https://github.com/uwopus/pico-code/blob/3594e67c1ac34e5454eb4db8362b673bcc7c8862/opus_comms/opus_comms.c#L44-L46) I found the fix.

I had to adjust the initialization of my SSP0 as following:

```
	SSPx_InitStructure.SSP_Mode  = SSP_Mode_Slave;
	SSPx_InitStructure.SSP_CPOL  = SSP_CPOL_High;
	SSPx_InitStructure.SSP_CPHA  = SSP_CPHA_2Edge;
	SSP_Init(SSP0, &SSPx_InitStructure);
```

Now the RX Fifo fills up correctly and with just one long Low Phase of my CS I can receive all eight bytes.

BR,
Johannes

---

Source: https://maker.wiznet.io/forum/15257
