This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

spi master reconfigure

Hi

i have an application where 3 SPI devices are connected. Each of the devices have a different CPHA/CPOL configuration. This means that, in order to make this work properly, I need to reconfigure the SPI configuration between the different peripherals. Also, i need to tell the spi master instance to use a different chip select pin.

Now: what is the most lightweight way of doing this? Should I implement a function myself in which I reconfigure 1 particular register? Can that register (Config) be changed on the fly or should I disable/enable the interface module before/after altering the register? Or should I just use spi_master_close/open, and if so, what are the side effects on the bus that I should take into account?

Parents Reply
  • Basically if you use \nRF5_SDK_11.0.0_89a8197\examples\peripheral\spi\ as a starting point, then the clean way to change the configuration is by calling nrf_drv_spi_uninit() followed with nrf_drv_spi_init(). However if you just want to change the CPHA/CPOL configuration you could simply write new configuration directly by writing to NRF_SPI0->CONFIG between nrf_drv_spi_transfer().

Children
No Data
Related