Manually activated SPI slave in MK20

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

Manually activated SPI slave in MK20

Jump to solution
1,371 Views
a_r_f_
Contributor II

Hi,

I've got a design with MK20D512 microcontroller, which is supposed to communicate over SPI as slave. According to the user manual, the SPI slave gets activated when the "slave select" ie. PSC[0]/nSS signal is asserted. However, in this case the "slave select" line is not available, and not connected to anything.

Is it possible to manually activate the SPI slave for transfer? For example, can the true "slave select" signal be set or cleared by activating internal pull-up or pull-down resistor (PORTx_PCRn, bits 1 and 0)?

Best regards,
Adam

Labels (1)
0 Kudos
1 Solution
1,178 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński

  Please tell me the detail K20 chip you are using, as you know K20 have a lot of chips.

  Actually, you need to configure the K20 SPI slave CS0 pin, you can check it from Chapter 10 Signal Multiplexing and Signal Descriptions in your chip reference manual. Just select the PCS0 for your pin, select the correct MUX.

pastedImage_1.png

Wish it helps you!

If you still have question about it, please kindly let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
9 Replies
1,178 Views
a_r_f_
Contributor II

Hello,

in this case it's not my design, and I even don't have it physically in my office. But yes, that's how it is - the SPI interface is routed to connector along with CS1 signal. My previous post was a bit imprecise - the pin with CS0 was connected to a component which was not populated, and fortunately turned out to be unnecessary, so it will remain this way. In the end the workaround by soldering a wire was accepted. Now we have a problem with DMA, but that's for another question.

Best regards,
Adam

0 Kudos
1,178 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński,

  Ok, thank you for your updated information.

 About the DMA question, you can create a new question post, we will help you in your new post.

  About this case, if you don't have any further question about it, please help to mark the correct answer, just to close this case, thank you!


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,179 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński

  Please tell me the detail K20 chip you are using, as you know K20 have a lot of chips.

  Actually, you need to configure the K20 SPI slave CS0 pin, you can check it from Chapter 10 Signal Multiplexing and Signal Descriptions in your chip reference manual. Just select the PCS0 for your pin, select the correct MUX.

pastedImage_1.png

Wish it helps you!

If you still have question about it, please kindly let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,178 Views
a_r_f_
Contributor II

Hello,

do you mean that I can just mux the pin to function as CS0 pin and activate pull-up or pull-down resistor as needed? I believe I have tried that and this didn't work.

Best regards,
Adam

0 Kudos
1,178 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński,

   Yes, you are right. You need to configure the PORT register, to select the PCS function.

   Please note, you use the correct CS0 pin for your slave.

   If you still have problems, please also check the SPI PCS signal, whether it is really pull low or not.   Please also check SPIx_MCR[PCSIS[4:0]] the related bit is match your real state.

Wish it helps you!

If you still have question about it, please kindly let me know.

Have a great day,
Kerry

 

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

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,178 Views
a_r_f_
Contributor II

Hello,

I think we're not talking about the same problem. If I understand correctly, you've explained that to use the SPI slave I should physically connect the CS signal to PCS0, and correctly configure the pin in the PCR register of the port.
However, my problem is that the microcontroller's pin with PCS0 function is not accessible on the board. Thus, I can't connect an external signal to this pin, and I'm looking for an option to drive the PCS0 signal from within the microcontroller - if that's possible at all.
I tried to use the internal pull-up and pull-down resistors of the microcontroller's pin, but it seems that the pull-up and pull-down are ignored if the pin is muxed to PCS. Is this so?

Best regards,
Adam

0 Kudos
1,178 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński,

   Which detail kinetis chip you are using, please tell me the chip part number.

   Please also tell me which SPI interface you are using, SPI0 or SPI1?


Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
1,178 Views
a_r_f_
Contributor II

Hello,

it's MK20DN512ZVMD10 and SPI1. The problem has been already mitigated, but, for future applications, I would really like to know if such solution with microcontroller triggering its own "slave select" is possible.

Best regards,

Adam

0 Kudos
1,178 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Adam Rudziński,

    Thank you for your updated information, MK20DN512ZVMD10  is the 144 MAPBGA, so you didn't fan out the SPI1_PCS0 pin, is it right? It is really a problem, as you know, to SPI slave, the PCS pin is the input pin to select the chip. and when it is the slave pin, you just can use PCS0 as the slave select input pin:

pastedImage_1.png

You can try to internally pull down, the internal pull up and pull down is used as the input pin.

 But, in my opinion, if it is the application, it's better to modify the hardware, and fan out the PCS0 pin, and connect it to your master PCS pin physically .

Wish it helps you!

Have a great day,
Kerry

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos