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

USB low-full-high speed peripherals Forum Discussions

JaMa_3208951
Level 1
Level 1

Hello,

When configured as an SPI slave how does the buffer work on this part? Does the buffer erase the oldest characters, or does it not allow new characters when the buffer becomes full?

Thank you,

Jake 

0 Likes
1 Solution

Hello Jake,

You can use the SPI slave CDC class in this case.

You can define a larger read size than the expected data write size from master, the SPI CDC slave will return the amount of data being received.

In case you define a smaller slave read size than the master write size, the slave read API will return as soon as the defined size in the SPI read is received.

 

For application development we have CyUSBSerialVCP library and an example project as well. Please refer to the USB-Serial SDK.

Also, when using SPI CDC class instead of developing a windows application, you can make use of a serial terminal like teraterm to capture the data continuously and display it.

Please let me know if you have any more queries.

Thanks,

Yatheesh

View solution in original post

0 Likes
3 Replies
YatheeshD_36
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hello Jake,

In normal USB-Serial SPI slave operation, it is expected to read the exact number of bytes of data written. Else, the Slave will return error. 

The device operating as SPI slave will not allow new data to be written when the expected count is reached.

Thanks,

Yatheesh

0 Likes

What should be done if the device is set up as a slave and the master does not know how many bytes will come through?

Could you send a read for an amount larger than what you expect? and potentially get back the desired data and then a bunch of zeros?

0 Likes

Hello Jake,

You can use the SPI slave CDC class in this case.

You can define a larger read size than the expected data write size from master, the SPI CDC slave will return the amount of data being received.

In case you define a smaller slave read size than the master write size, the slave read API will return as soon as the defined size in the SPI read is received.

 

For application development we have CyUSBSerialVCP library and an example project as well. Please refer to the USB-Serial SDK.

Also, when using SPI CDC class instead of developing a windows application, you can make use of a serial terminal like teraterm to capture the data continuously and display it.

Please let me know if you have any more queries.

Thanks,

Yatheesh

0 Likes