SPI Slave crashes with high frequency data rate

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

cross mob
AlSt_4777661
Level 1
Level 1
First like given

Dear all,

I have a cy7c65215 with the scb1 configured as slave (with C++ code) and with the following parameters:

cySPIConfigSlave.frequency = 1000000;

cySPIConfigSlave.frequency = 1000000;

cySPIConfigSlave.dataWidth = 8;

cySPIConfigSlave.protocol = CY_SPI_MOTOROLA;

cySPIConfigSlave.isContinuousMode = false;

cySPIConfigSlave.isMsbFirst = true;

cySPIConfigSlave.isMaster = false;

cySPIConfigSlave.isSelectPrecede = false;

cySPIConfigSlave.isCpha = false;

cySPIConfigSlave.isCpol = false;

As master i have another board from silicon labs which normally sends a packet of 255 bytes every 50 [ms].

Normally the communication works well, but when the master sends a burst of 6 (packets of 255 bytes) with a distance of 40 [us] between packets the cypress library "read function" returns error due to the fact that it reads less bytes than expected.

Is there any way to increase cypress board internal buffer (if there is one) in order to handle this case ? or is it possible to handle it in some way ?

Many Thanks.

Alessandro    

0 Likes
1 Solution
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Alessandro,

SPI in vendor mode will expect the exact number of bytes of data specified in the length parameter of the read buffer (CY_DATA_BUFFER* readBuffer), else it will return with an error if the data received is more or less.

1. You can configure the length parameter of the read buffer to 255 and call the CySpiReadWrite repeatedly for n number of times , make sure that the delay is very less between the calls (or) you can set up the buffer length to 255*6.

2. You can also add a flow control. Set a gpio as input on the USB-Serial device and whenever the master wants to send data, it can notify the USB-Serial device through the gpio.

Alternatively,

If the master continuously sends data, then you can try using the CY7C65215A (pin compatible with CY7C65215) which has SPI in CDC mode. You can open a terminal like tera term to continuously capture the data or develop a custom host application using the USB-Serial VCP library.

Thanks,

Yatheesh 

View solution in original post

0 Likes
1 Reply
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Alessandro,

SPI in vendor mode will expect the exact number of bytes of data specified in the length parameter of the read buffer (CY_DATA_BUFFER* readBuffer), else it will return with an error if the data received is more or less.

1. You can configure the length parameter of the read buffer to 255 and call the CySpiReadWrite repeatedly for n number of times , make sure that the delay is very less between the calls (or) you can set up the buffer length to 255*6.

2. You can also add a flow control. Set a gpio as input on the USB-Serial device and whenever the master wants to send data, it can notify the USB-Serial device through the gpio.

Alternatively,

If the master continuously sends data, then you can try using the CY7C65215A (pin compatible with CY7C65215) which has SPI in CDC mode. You can open a terminal like tera term to continuously capture the data or develop a custom host application using the USB-Serial VCP library.

Thanks,

Yatheesh 

0 Likes