SPI trasmit and receive on rising clock edge

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

cross mob
Not applicable
Hi,

is it possible to transmit and receive SPI data on the rising clock edge, using the XMC4800 in full duplex mode?

Thanks in advance.
0 Likes
5 Replies
chismo
Employee
Employee
First like received
Hello,

The nature of the SPI protocol is that transmit and receive are always done on alternate edges of the clock.

For example, we can have transmission of data on the leading rising clock edge and the reception on the trailing falling clock edge.
Therefore, within one clock cycle, it is possible to transmit and receive to have the full duplex effect.

Regards,
Min Wei
0 Likes
User16349
Level 1
Level 1
Welcome! First reply posted
Hi.
I have the same question.

>>The nature of the SPI protocol is that transmit and receive are always done on alternate edges of the clock.
Really?
SPI has 4 modes and everywhere and reception and transmission occur on same front.
https://en.wikipedia.org/wiki/Serial_Peripheral_Interface

It is good that we can get higher speed when working on different fronts. But for this, the slave device must support this feature .
In my case, Wiznet w5500 both receives and sends data on the rising edge

3470.attach

As a result, when I receive data, I receive garbage.
How can i solve this problem
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

From the W5500 datasheet:
"With SPI Mode 0 and 3, data is always latched in on the rising edge of SCLK and
always output on the falling edge of SCLK.The W5500 supports SPI Mode 0 and Mode 3."
See Figure 6. SPI Mode 0 & 3 in the W5500 datasheet.

Regards,
Jesus
0 Likes
User16349
Level 1
Level 1
Welcome! First reply posted
That is, you answered without even looking at the picture you specified?
The picture confirms that the change of data on both lines occurs on a falling front and reading on an ascending one.
Both for transfer and for reading.
3466.attach

And this does not correspond to the picture from your datasheet
3467.attach

3468.attach

At the moment, the only solution comes to me - to switch modes after each transmission and reception
0 Likes
jferreira
Employee
Employee
10 sign-ins 5 sign-ins First like received
Hi,

Maybe I'm wrong but from the W5500 datasheet it seems to me that the device is reading (sampling) on the rising edge and transmitting on the falling edge (toggling).
Check SPI_MASTER APP in DAVE
3496.attach

XMC_SPI_CH_ConfigureShiftClockOutput(XMC_SPI0_CH1,
XMC_SPI_CH_BRG_SHIFT_CLOCK_PASSIVE_LEVEL_0_DELAY_DISABLED,
XMC_SPI_CH_BRG_SHIFT_CLOCK_OUTPUT_SCLK);

XMC_SPI_CH_DataLatchedInTrailingEdge(XMC_SPI0_CH1);

Regards,
Jesus
0 Likes