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?
已解决! 转到解答。
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:
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
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:
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