Hello ! How can I configure nrf_drv_spi with me writing the CS pin to LOW and HIGH whenever I want to address a different peripheral ?
Hello ! How can I configure nrf_drv_spi with me writing the CS pin to LOW and HIGH whenever I want to address a different peripheral ?
You can define the SS pin as not connected
NRF_SPIS_PIN_NOT_CONNECTED
See
infocenter.nordicsemi.com/index.jsp
Then use GPIO in you code to assert the CS pin youself before calling the nrf_drv_spi_transfer and clear it in the completion callback etc.
Generally just enabling the CS pin all the time can cause problems
Often the protocol for peripherals involves sending 1 or 2 byes with a register address, followed by writing or reading multiple bytes
However, devices often rely on CS going low to indicate that a new transfer is about to take place and that the next data from the MCU is a command e.g. READ REGISTER
You should check the data sheet for the peripheral you are using, to make absolutely sure it allows CS to be enabled all the time
(Personally I would not do this, because if you get out of sync you will be sending or receiving garbage , to or from the peripheral
Hi Robert and Roger Clark!
We can disconnect a PIN during the SPI Bus Initialization itself right? ( .ss_pin = NULL)
or is it necessary to have not connected?
Please correct me if I am wrong.
Hi Robert and Roger Clark!
We can disconnect a PIN during the SPI Bus Initialization itself right? ( .ss_pin = NULL)
or is it necessary to have not connected?
Please correct me if I am wrong.
Yes, if you want to control it your self with the GPIO HAL then you can initialize the SPI driver with .ss_pin = NRF_SPIS_PIN_NOT_CONNECTED.