Inadequate number of slave selects in SPI_PUSHR_PCS macro

Status
Not open for further replies.

liljaywalker

New member
Long time lurker, first time poster.

I'm working on a little project that utilizes all 6 slave selects on SPI0 on a Teensy 3.6. When using the SPI_PUSHR_PCS macro, i noticed that it would let me set the 6th PCS. According to the Memory Map/Register Definition to SPIx_PUSHR in the reference manual, it shows 6 bits allocated to PCS selection.

Kinetis.h line 4417 is the culprit:
Code:
#define SPI_PUSHR_PCS(n)		(((n) & 31) << 16)		//

I suggest this get updated in the future to
Code:
#define SPI_PUSHR_PCS(n)		(((n) & 63) << 16)		//
 
Also just noticed the same thing for the PCSIS fields in the MCR for selecting the active/inactive states of the slave selects.

line 4369 of kinetis.h:
#define SPI_MCR_PCSIS(n) (((n) & 0x1F) << 16) //
change to
#define SPI_MCR_PCSIS(n) (((n) & 0x3F) << 16) //

And also there are 8 instances in SPI.cpp and 2 in SPI.h of
... | SPI_MCR_PCSIS(0x1F)
that should change to
... | SPI_MCR_PCSIS(0x3F)

Thanks for the quick responses on this.
 
Status
Not open for further replies.
Back
Top