SPI Slave DMA Problem: Missing bytes

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

cross mob
lock attach
Attachments are accessible only for community members.
joli_601446
Level 5
Level 5
10 likes given 10 sign-ins 5 sign-ins

Hello, I have an application in which another processor is the Master SPI and the PSOC5 is the Slave SPI. The SPI clock is 800Khz and I would like the Master to send over 10 bytes in a burst. The Master is receiving 10-bytes back from the SPI Slave which is good. The problem is the SPI slave is not receiving all 10 bytes and the sequence is not correct.

spi_view.jpg

Originally I did not use a DMA to receive the data but the Slave was dropping bytes. So, I thought I should try using a DMA. I am fortunate to have found an example using a DMA to read the SPI Rx FIFO.

I got the example to work but now the problem is I only receive 4 bytes of data. The SPI interrupt is set which kicks of a DMA transfer. I see the interrupt occurring 10 times which is good but the data is missing:

Debug_View.jpg

I don't know what I must do to capture all of the 10-bytes form the Master SPI device.

I would like to be able to send a burst of data rather than sending a byte and then delay and then send another byte.

If anyone can help me with getting this to work or suggest another approach that does not require a DMA please let me know.

Thanks,

Joe

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Hello, I have solved the problem with the SPI Slave DMA example code you sent. I will attached my code for your review and for others who may be interested. The problem I was having is that SPI modes on the device I am interfacing with are not exactly standard, or I should say don't exactly follow the SPI modes from Cypress. I am interfacing with a ARM+DSP processor from TI. In order to get things to work I had the TI processor set to CPHA = 1 and CPOL = 0 and the PSOC CPHA=1 and CPOL = 1.

Thank you very much for the DMA example and thank you for not kicking me to the curb when I'm too slow.

Respectfully,

Joe

View solution in original post

0 Likes
5 Replies
lock attach
Attachments are accessible only for community members.
BragadeeshV
Moderator
Moderator
Moderator
First question asked 1000 replies posted 750 replies posted

Hi joli_601446​,

DMA can be a good option in your case since you have a deterministic no of bytes in your application. I've created an example project according to your application to get 10 bytes of data using DMA. An interrupt is generated after all 10 bytes are received. Please find the attached project file and let me know if it helps. Please use this project as reference for creating your application.

pastedImage_0.png

I used Aadvark analyser as the SPI master to send 10 bytes of data to SPI slave (PSoC).

pastedImage_1.png

Also in your project file I noticed that none of the TX interrupt sources were enabled for SPI slave. Please use TX FIFO not full interrupt to trigger the DMA channel correctly.

EDITS: Project file attached

Regards,

Bragadeesh

Regards,
Bragadeesh
0 Likes

Hello, and thank you for responding to my message. Could you upload an archive of your project please?

Thank you very much,

Joe

0 Likes

Hi joli_601446​,

Sorry, I forgot to attach the project file. I've edited my previous response and I've attached the project file with it.

Regards,

Bragadeesh

Regards,
Bragadeesh

Bragadeesh

Hello, thank for the example code. I'm working on it and will let you know how things turn out.

Respectfully,

Joe

0 Likes
lock attach
Attachments are accessible only for community members.

Hello, I have solved the problem with the SPI Slave DMA example code you sent. I will attached my code for your review and for others who may be interested. The problem I was having is that SPI modes on the device I am interfacing with are not exactly standard, or I should say don't exactly follow the SPI modes from Cypress. I am interfacing with a ARM+DSP processor from TI. In order to get things to work I had the TI processor set to CPHA = 1 and CPOL = 0 and the PSOC CPHA=1 and CPOL = 1.

Thank you very much for the DMA example and thank you for not kicking me to the curb when I'm too slow.

Respectfully,

Joe

0 Likes