Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 8 months ago.
Assert SSEL during SPI transfer on LPC82x
I'm trying to send a data using SPI with automatically control of SSEL pin. As the source code below (using LPC82x, for example), after setting up of usual SPI and manual SSEL pin assignment by settting SWM's PINASSIGN register, the data is writting to TXDATCTL reg with the bits of TXSSEL0_N, EOT, and EOF bits as 1. I confirmed the SPI transfer, but without SSEL generation, that remains 1.
SPI spi(P0_19, P0_17, P0_13); ... LPC_SWM->PINASSIGN4 &= 0xff0cffff; assign P0_12 for SPI0_SSEL0 LPC_SPI0->TXDATCTL = (1 << 20) | (1 << 21) | (0xf << 16) | (1 << 22) | (15 <<24) | data; send data with TXSSEL0_N=1, EOT=1, EOF=1, RXIGNORE=1
By changing the polarity of SSEL by setting SPOL0 bit in CFG register, the SSEL pin remains 0; that means that SSEL pin is actually configured as SSEL pin of SPI0.
Can someone find why it doesn't enable SPI transfer with SSEL generation?
1 Answer
9 years, 8 months ago.
You need to use a DigitalOut pin to control the SPI CS/SSEL in your code when using the SPI mastermode. Any pin may be used for the CS pin.
The SSEL is only used in the SPISlave mode and in that case it must be provided as a parameter in the SPISlave instantiation. In this case the SSEL pin must be one of the allowed pins for the selected SPI engine.
Thanks for your reply. Yes, the conventional way to use SSEL with SPI on mbed library is to use software-controlled DigialOut pin, as you say. However, LPC82x has the hardware SPI unit that capable to drive SSEL without software control of DigitalOut pin in master mode. I want to use this function.
posted by 14 Mar 2015
Oh, it was for my misunderstanding on the TXSSEL0_N bit in TXDATCTL register... The datasheet says that the SSEL0 is assert/disasserted during SPI transfer if TXSSEL0_N is 0. I confirmed the proper SSEL0 generation with setting TXSSEL0_N bit as 0 with writing data.
posted by Junichi Akita 15 Mar 2015