S32K144 Choose alternate SPI pin

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

S32K144 Choose alternate SPI pin

跳至解决方案
1,594 次查看
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 项奖励
回复
1 解答
1,587 次查看
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 项奖励
回复
1 回复
1,588 次查看
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 项奖励
回复