TWR-K20D50M as SPI Slave over TWRPI?

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

TWR-K20D50M as SPI Slave over TWRPI?

740 Views
dhecker
Contributor I

Is the TWRPI connector J3 pin 11 on the TWR-K20D50M suppose to be PTD0/DSPI0_PCS0, and not connected to pin J3-20 (PTD4/DSPI0_PCS1)?  Without access to DSPI0_PCS0 on the TWRPI connector, the TWR-K20D50M can't be configured as an SPI Slave can it?  If I have a TWRPI device that must be the SPI Master, please share (if there's a way) how I can configure the TWR-K20D50M to be an SPI Slave (using SPI over the TWRPI of course).  The hope was to use J3-20 (or other GPIO) as an SPI interrupt to let the SPI Master know the TWR-K20D50M (in SPI Slave mode) had data to send, and the Master then use PCS0/SS as the Slave Select.

0 Kudos
Reply
1 Reply

503 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Doug Hecker,

      PTD0 is not connect with J3 now, actually, you can choose PTC4_UART_TX instead of PTD0, the function of pin PTC4  is PTC4/LLWU_P8/SPI0_PCS0/UART1_TX/FTM0_CH3/CMP1_OUT, it also have SPI0_PCS0 function. This pin is connect with J1 pin2 . You can use one wire connect with the CS of your SPI master chip.

    About how to configure it as the slave, you should follow these steps:

1. Configure the SPI pins function in the PORT register. choose the right pin mux.

2. Enable the SPI clock gate in SIM register : set SIM_SCGC6[SPI0]

3. Configure your K20 as SPI slave, clear SPIx_MCR[MSTR]

4 . configure the slave Clock Polarity  and Clock Phase in register SPIx_CTAR_SLAVE the same with your master.

Wish it helps you!

If you still have problem, please contact me!


Have a great day,

Jingjing

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply