Gossamer
Gossamer

Reputation: 309

lpc1788 ssp (SPI) - proc to proc communication

I would like to send string of chars from one proc (master) to another (slave) and then read string from a slave.

Currently im mixing up the arduino and LPC1788, using lpc as master and arduino as slave. LPC sent's the string correctly which is received by the arduino in ISR. In loop function i check if all of the chars are received and then try to send string back. On LPC side ISR is not working for some reason. I have set SR as

SR = (1<<TNF) | (1<<RNE);

So i have put delay after sending the string from LPC and then initiate read from arduino.

What i see on LA for sending the string is:

enter image description here

but reading of string from Arduino looks odd (string should be "Pong\n", it is not always P that i received... it varies) enter image description here

i guess majority of problem is within the sync of sending and reading of SPI buffer. How do i achieve that without functional ISR on LPC?

Upvotes: 0

Views: 1232

Answers (1)

madD7
madD7

Reputation: 941

The SPI specification states that the CS (SSEL) line should be active during a frame and become inactive in between. NXP interpreted this as a word being one frame. This means that the CS as generated by the SSP block (the same goes for the legacy SPI) is only active during one transaction of up to 16 bits.

Note also that there is always a gap in between the words/frames being sent. So even when you fill the FIFO or use DMA you will see 16 clock pulses, a short delay and then 16 more pulses.

When using a GPIO pin as SSEL, please note you have to wait for SSEL assertion or de-assertion until the peripheral is idle.

Upvotes: 0

Related Questions