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

how to switch peripheral use at runtime

Hello,

My setup is as such. I use SPIM1 and SPIM2 all the time. SPIM1 goes to a set of MEMs devices, and SPIM2 is dedicated to a Memory module.

My device runs in of of two modes which are mutually exclusive. In one mode I run SPIS0 and talk to the chip via an USB to SPI bridge chip. In the other mode I want to run TWI to talk to an RTCC chip. The issue is I do not see a way to compile the code or get around the compiler error:

._build\nrf52832_xxaa.axf: Error: L6200E: Symbol SPIM0_SPIS0_TWIM0_TWIS0_SPI0_TWI0_IRQHandler multiply defined (by nrf_drv_twi.o and nrf_drv_spis.o).

I have read in the documentation that you need to disable one peripheral usage before assigning another, which is not an issue in my case as I only initialize the peripheral usage I need when the device is turned on and determines which of my two modes the device is operating in.

So how do I get around the compiler error? Is there a supported method in the SDK already?

I am using Keil.

Thank you

Parents
  • Hi,

    You cannot use several peripheral instances that share the same IDs/base addresses at the same time. Here is the table of which IDs/base address the different peripheral instances use. Here you can see that e.g. TWIS0 and SPIS0 have the same ID, and cannot be used together.

    But, you can use peripheral resource sharing(PERIPHERAL_RESOURCE_SHARING_ENABLED). This enables you to first use e.g. TWIS0, then you have to uninitialized it, and then you can use SPIS0.

Reply
  • Hi,

    You cannot use several peripheral instances that share the same IDs/base addresses at the same time. Here is the table of which IDs/base address the different peripheral instances use. Here you can see that e.g. TWIS0 and SPIS0 have the same ID, and cannot be used together.

    But, you can use peripheral resource sharing(PERIPHERAL_RESOURCE_SHARING_ENABLED). This enables you to first use e.g. TWIS0, then you have to uninitialized it, and then you can use SPIS0.

Children
No Data
Related