SSP Slave mode not working

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SSP Slave mode not working

1,581件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Thu Jan 07 14:36:35 MST 2016
I am using the code example in lpc11xx.keil-examples-CMSIS-update_2 to implement SPI in slave mode. I configured the ssp.h and ssp.c found in the example folder, but can't seem to get data into the receive buffer. I am using a TotalPhase Aadvark USB to SPI controller to send data to the LPC1111. I've tried changing clock speed and set it as Master and do get a clock output on SCK, but do not see data come out.

Thank you for your help.

Original Attachment has been moved to: ssp_0.c.zip

Original Attachment has been moved to: ssp.h.zip

Original Attachment has been moved to: main_19.c.zip

ラベル(1)
0 件の賞賛
返信
6 返答(返信)

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Mon Jan 11 13:40:16 MST 2016
Oops, accidentally changed the CPOL and CPHA to 1 1 in SPI1, not 0. Made these changes to SPI0 and it is receiving all 16 bytes now.
0 件の賞賛
返信

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Mon Jan 11 13:25:37 MST 2016
Yes, I'm checking with the oscilloscope. I've tried changing CPHA 1 and CPOL 1, but same results. I'm looking at the Master and it is keeping the SSEL pin low for the entire 16 bytes transmission.
0 件の賞賛
返信

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mysepp on Mon Jan 11 13:17:58 MST 2016
Could it be that device is deselected (CS goes up) after first byte? Have you checked with an oscilloscope or logic analyzer?
0 件の賞賛
返信

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Mon Jan 11 13:13:28 MST 2016
Working in Slave mode, the master sends 16 bytes of data to the slave, however, only the first byte makes it into the slave buffer. If I send 16 bytes 16 times, then the buffer fills up. However, all with the first byte sent (data string sent is: 0x00 0x11 0x22 0x33 0x33 ... 0xFF).

It does not seem the SPI Data Register is receiving all the bytes.
0 件の賞賛
返信

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Mon Jan 11 09:59:26 MST 2016
I narrowed down the cause. It seems the timer0 initialization is interfering with the SPI. I'm going to look at what register it could be overriding the SPI settings.
0 件の賞賛
返信

1,462件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by dlo on Mon Jan 11 08:59:09 MST 2016
Still trying every possible combination in the ssp.h, but to  no avail. When I use the ulinkme to debug, the program always hangs inside the ssp.c file: while ( !(LPC_SSP0->SR & SSPSR_RNE) ); It seems it never receives anything in the buffer to raise the flag.
0 件の賞賛
返信