When to call SPIClass::setCS()

Status
Not open for further replies.

kito

Active member
Does anybody use the hardware CS feature? The documentation on hardware CS function is unclear as all the examples just manually control CS.
Is it proper to call SetCS() before or after SPI.begin() in the setup?
 
The setCS call is important if you are using hardwareSPI directly using the registers like the PUSHR register, where you have control of which CS pins get controlled by the transfer. It returns a mask of the actual pin select...

You can see examples of it if you look at the ili9341_t3 library code
 
Thanks KurtE.

So basically SetCS (pin) sets a mux so the IO pin takes on the alternative function CS and its pin returns the PCS mask. I find it misleading however that there is no support for the CS pin in the transfer function. Its kind of a misleading function name. A new user will probably assume if library has a function name like SetCS that enables the CS hardware feature then transfer function would use it. It should have a comment that this is an advanced feature which requires writing directly K20 PUSHR macro instead of trasfer APIs.
 
Status
Not open for further replies.
Back
Top