I have the Promira Serial Platform configured with SPI Active - Level 3 Application, which I am using as an SPI master to communicate with an SPI slave device. It works well until I set the SPI bitrate higher at 53,333 kHz.
At that higher bitrate, the Promira platform initially works well. However, after several minutes, the Promira platform starts sending corrupt data and eventually there is no communication. I used an oscilloscope and a logic analyzer to trace the SPI bus – I saw no data on the bus.
I have the script set up as a queue, as described in section 5.5.3 Queue of the Promira Serial Platform I2C/SPI Active User Manual where I am using API commands ps_queue_create … ps_queue_destroy continuously and setting the bitrate at high frequencies. Is this method correct? Also, are there other possible causes for the issues I observed?
Response from Technical Support:Thank you for your questions! We will provide an overview of how the queue works, and tips for troubleshooting issues such as this.
Here is an example of using the Promira API queue mechanism for an SPI transfer:
In this example, from step 10, ps_collect_resp is called repeatedly until there is no more data to read from the queue buffer. When collecting and storing data in a local buffer, the queue buffer is consistently emptied and then re-filled with incoming data. Doing this quickly and consistently ensures data is not lost, that the 2MB buffer does not overflow.
Additional Promira API examples are available, which can be downloaded. One API example that may be useful to you is spi_file. This script configures the Promira platform as an SPI master device that sends data. The dev_collection() function collects data from the slave device.
The issue that you described, corrupted data followed by data no longer transferred, indicates buffer overflow.
We hope this answers your questions. Additional resources that you may find helpful include the following:
If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.