LPC11xx SPI/SSP Problem

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11xx SPI/SSP Problem

1,049 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Coralicious on Thu Mar 14 10:58:01 MST 2013
Hi! I'm using lpc1113/301 for a master-slave communication. Now I'm using as a slave, and I know that Master is sending 3 bytes (0x55, 0xff, 0xff) to me. I can receive them only by setting DSS data to 16-bit (LPC_SSP1->CR0 = 0x070f) but I should receive them also by setting DSS data to 8-bit, so I could send my answer to the master at the same time I receive it's second byte.

The problem is, if I do set DSS data to 8-bit, in my buffer I just receive 0x55, 0x55, 0x55 (the first byte the master sends to me).

When I look to my oscilloscope, I can see on MOSI the 3 data bytes, but in my LED, which I programmed with a toggle to see when does the SSP1_IRQHandler starts, I see that it works each 2 frames of data (each time I've recived the 3 bytes for twice).

What can I do to solve this, so receive 1 byte of data and answer 1 byte just after this?

Sorry for my english :(
0 Kudos
Reply
5 Replies

1,012 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Coralicious on Mon Mar 18 05:35:20 MST 2013
Could please someone explain to me why does the SSP1_IRQHandler(); starts only with the timeout condition?

Anyway, when I put my SSP_Receive() to get data from the DR, that function needs 3 parameters (portNum, *buf, Length). When I specific the third parameter (suppose Length = 'X'), the oscillator shows me that SSP1_IRQHandler(); starts each 'X' times.

Shouldn't it start each received frame?
0 Kudos
Reply

1,012 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Coralicious on Fri Mar 15 04:20:12 MST 2013
Hi Zero. Thanks for your files but I'm not doing it by polling. I need to communicate master and slave by interruption :/
0 Kudos
Reply

1,012 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Fri Mar 15 03:40:29 MST 2013
Then your problem is obviously your SPI code / setting. There's no reason why your LPC shouldn't receive 8bit ;)

I would suggest to use a working code like

http://knowledgebase.nxp.com/attachment.php?attachmentid=552&d=1316436457

with master / slave code and compare / use that :)
0 Kudos
Reply

1,012 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Coralicious on Fri Mar 15 03:14:55 MST 2013
My master frame is now on 8bit. I don't know why my SSP1_IRQHandler doesn't start each time I have some data on my receive buffer. It starts each time I've received the 16bits from master for twice.
0 Kudos
Reply

1,012 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ex-kayoda on Fri Mar 15 02:33:56 MST 2013

Quote: Coralicious
I can receive them only by setting DSS data to 16-bit (LPC_SSP1->CR0 = 0x070f) but I should receive them also by setting DSS data to 8-bit...



I'm confused, what's your master frame (= SSEL or CS), 16 or 8 bit :confused:
0 Kudos
Reply