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

How to Switch from spi0 to i2c0

Hi

i am using NRf51822 custom board. In that i have NOR(spi0) and LED(i2c0).

But switching from spi0 to i2c0 is not possible so that i am not able to switch

off led. But once i comment the spi_master_init(), led is going to off.

I know both uses same id means have same base address.

Kindly suggest how to switch from spi0 to i2c0.

i am not going to change spi and i2c bus for NOR and LED , because i have some other peripherals,

which is connected to i2c1 and spi1 bus.

Regards Balaji

Parents
  • As you can see in the instance table (table 3 in the nRF51 Reference Manual), SPI0 and TWI0 share the same register space. You can therefore not use them simultaneously. Instead, I'd recommend you to either use SPI0 and TWI1 (or opposite), or make sure to disable SPI0 by writing the appropriate value to the ENABLE register and only after this initialize TWI0.

Reply
  • As you can see in the instance table (table 3 in the nRF51 Reference Manual), SPI0 and TWI0 share the same register space. You can therefore not use them simultaneously. Instead, I'd recommend you to either use SPI0 and TWI1 (or opposite), or make sure to disable SPI0 by writing the appropriate value to the ENABLE register and only after this initialize TWI0.

Children
No Data
Related