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

Conflict between SPI1 and TWI1 on nRF51

Hello

I've been having some strange problems with my SPI and TWI bus. In my setup, I'm using SPI0 and TWI1. I noticed that, even though I'm not using it, that SPI1 was consuming a lot of power so I disabled it with NRF_SPI0->ENABLE = 0;.

Now I seem to be having problems with my TWI1 bus, it stops working sometimes when SPI1 is disabled, why is this happening? Are they somehow related? Or how do I stop the SPI1 bus from consuming power when I'm not using it?

Thanks

  • I think that SPI1 and TWI1 use shared hardware, I do not have the product specification in hand but their base addresses are same as far as i can remember. Do not disable SPI1 when you are using TWI1

  • Thanks, yes they have the same address and from looking at the Peripheral options in the debug menu I can see the TWI1 gets disabled when I disable the SPI1. Do you know a good way to disable the TWI1 bus after I'm finished using it? I've tried disabling with NRF_TWI1->ENABLE = 0; and enabling again with NRF_TWI1->ENABLE = 1; but the bus never re-enables? The combined SPI1/TWI1 bus seems to use a lot of current(~1mA) when its not in use so I'm trying to reduce this.

  • Is your main problem now to disable and enable the TWI? or is it with the current cunsomption? Are you using XTAL clock? if you are using internal RC HFCLK then this current consumption does not be explained unless there are other modules you are using and are active at the time of current measurement, Are you sure that you are measuring this increased current because of SPI1 or are there some other modules active? what is your working environment like which SDK, SD and hardware?

    Do you wait for EVENTS_READY before using TWI!?

  • I think I solved the problem. I switched to the twi_sw_master library instead of the hardware version and it works fine now, i.e. there is now no longer excessive current draw when not using the TWI bus. The nRF51 chip I'm using uses an older revision of the silicon, which I believe had problems with the TWI hardware implementation as described here:

    devzone.nordicsemi.com/.../

    Thanks for your help.

Related