Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Swapping a I2C peripheral to SPI peripheral during runtime, conflict with sdk_config.h

Hi, I want to use 2 I2C instances and 2 SPI instance during setup, and later switch to 1 I2C instance and 3 SPI instance. To do this, I tried to swap TWIM2 instance to SPIM2 instance during runtime, but I'm having some problems.

I cannot simply change the instances in software, as they need to be enabled in sdk_config.h file, and I cannot enable both SPI and I2C for the same peripheral, e.g. enabling both TWIM2 and SPIM2 will cause a compiler error, even if do not use both simultaneously. Also, I cannot enable during runtime, as sdk_config.h is used during compile time.

Is it possible to configure sdk_config.h in a way to allow this?

Related