S32K144 Choose alternate SPI pin

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

S32K144 Choose alternate SPI pin

Jump to solution
1,703 Views
ruihang_wu
Contributor III

Is there anyway to choose CS pins that are not in the SPI config dialogue?

For example if I choose instance 0 CS0 has the option to be PTB0 or PTB5, CS1 can only be PTB5. Is there a way to set either one to a different pin other than the ones in the dropdown?

Screenshot 2020-10-15 115718.png

0 Kudos
Reply
1 Solution
1,696 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @ruihang_wu ,

All the pins displayed in the PCS dropdowns are pins that can be directly controlled by the LPSPI peripheral. So when you want to transfer bytes to a slave device, the hardware will automatically set the PCS pin to low and after the transfer is completed, the pin is set back to High state.

If you want to use the LPSPI as Master and another pin as PCS, that the ones that can be controlled by the hardware, then you have to use a GPIO block to manually select the slave device, and to use a Blocking transfer. Something like this:

mariuslucianand_0-1602785175462.png

But you have to set the blocks priorities in order to be sure that the code is generated in this way. The pin sets low before transfer, actual transfer take place and the pin is set back to High (this is the Active low scenario).

I don't think that this scenario applies for the LPSPI configured as slave. For that case you have to use a hardware controlled PCS.

Hope this helps,

Marius

 

 

View solution in original post

0 Kudos
Reply
1 Reply
1,697 Views
mariuslucianand
NXP Employee
NXP Employee

Hello @ruihang_wu ,

All the pins displayed in the PCS dropdowns are pins that can be directly controlled by the LPSPI peripheral. So when you want to transfer bytes to a slave device, the hardware will automatically set the PCS pin to low and after the transfer is completed, the pin is set back to High state.

If you want to use the LPSPI as Master and another pin as PCS, that the ones that can be controlled by the hardware, then you have to use a GPIO block to manually select the slave device, and to use a Blocking transfer. Something like this:

mariuslucianand_0-1602785175462.png

But you have to set the blocks priorities in order to be sure that the code is generated in this way. The pin sets low before transfer, actual transfer take place and the pin is set back to High (this is the Active low scenario).

I don't think that this scenario applies for the LPSPI configured as slave. For that case you have to use a hardware controlled PCS.

Hope this helps,

Marius

 

 

0 Kudos
Reply