SPI Transmissions in 8 bit words

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

SPI Transmissions in 8 bit words

283 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rorrik on Fri Sep 05 11:59:15 MST 2014
I am trying to send data 8 bits at a time across SPI using the LPC812, with a delay between words. I've implemented a delay, but my words are 16 bit. To satisfy the conditions of the setup configuration, I put my 8 bit data in a 16 bit int array. And though I have set the DataSize to 8, it still uses two words at a time in transmissions. Is there a way to work around this to send the 8 bit data my slave is expecting?
0 Kudos
2 Replies

263 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Rorrik on Tue Sep 09 07:48:57 MST 2014
From what I'm seeing here, that's not strictly true. I have set data length to 8, and it sends 16 bits. The progressions is interesting. When XfSetup.DataSize = X, where X < 8, T, the transmitted number of bits, is T=X, however, where X >= 8, T=2*X. Unless you are referring to some other way to set the 'Data Length' to 1 to 16 bits, in which case I would be happy to know where to do this correct setup. Right now I am sending two 4 bit words back to back before my pause between bytes. This is cludgey and requires me to reformat my data, so I would be happy to know if there is a better solution that can be explained using the provided libraries.

Edit: Investigation reveals that TXCTRL yses the DataSize value when called, confirming my suspicions. 8 does not seem to be a possible number of bits to send.
0 Kudos

263 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Sep 05 19:50:38 MST 2014
Chips with new SPI peripheral use TXCTL (or TXDATCTL) to set 'Data Length' 1 to 16 bits  :)

There's no workaround necessary, just correct setup...
0 Kudos