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

Problems using TWI in slave mode

Hello,

I am using a development board pro nrf52840 mini from Sparkfun. 

I'm trying to use the TWI peripheral on nrf52840 to communicate with an external device (another microcontroller). The nrf52840 is supposed to be a slave on TWI and the external device to be the master. I'm using the example 'nRF5_SDK_15.3.0_59ac345\examples\peripheral\twi_master_with_twis_slave\' with SCL on PIN P0.11 and SDA on PIN P0.8 and I have a problem that the slave does not respond. 

In this example, I do not know which instance of TWIS is activated and I do not find in the documentation which pins correspond to which TWIS instance.

From the external device, I scan for the TWI address in interval [1,127] and nrf52840 does not respond at any address.

Can you, please, tell me how can I modify this example code so the slave answers or can you provide an example to startup the slave and to receive data?

Thank you.

  • Thank you very much, but I tried with your first example (to shorten the pins of the same board) and SCL and SDA lines are down all the time. I analyzed RESET pin and it's ok, even if the blue led is blinking continuously (is this blink normal?).

    Which soft are you using to see NRF_LOG messages?

    Are you using sparkfun nrf52840 mini or another board?

  • Use Termite and choose the following parameters:

    The nRF52840 DK comes with an interface MCU that features a USB to UART Bridge, however, I don't think the nRF52840 Sparkfun board has that. Then you can configure a UART peripheral instance and use a cable like this to see the logging. UART logging should be enabled in the file sdk_config.h of the project I provided

    I used the nRF52832 DK, I haven't tested it on the nRF52840 DK, or Sparkfun nRF52840 mini for that matter. However, I think it should work on those boards as well.

    It is strange that you don't see any output on the Sparkfun board. Maybe it's broken? Could you try to use some other GPIO pins for TWI_SCL/SDA_M and EEPROM_SIM_SCL/SDA_S and see if that works? You could also consider buying the nRF52840 DK.

    Best regards,

    Simon

Related