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

Usage of Twi_Scanner-Example impossible

Hello,

I am was playing around a bit with the twi_scanner-example and I figured out, that no matter if I chose the legacy-layer with nrf_drv_twi-functions or the new nrfx_twi-functions I am always getting NRF_SUCCESS-messages on all I2C-addresses available, indicating that a device was successfully found.

Tried that with rx-/tx-functions likewise and also on the nRF52832-/nRF52840-DK including our own custom boards.

Even though I have just 1 specific sensor attached to the I2C-bus it shows possitive findings on all addresses, which makes the scanner-functionality obviously useless...

On the other hand I am able to successfully configure, read and transmit the sensor data with S132-/S140-softdevice-based-examples.

Is there anything I might be forgetting!?

Additional note: The plain twi_scanner-Example shows no results at all on the respective DKs with a sensor connected.

Kind regards,

Ray

Parents
  • Hi Harald,

    You are correct that this is not the intended behaviour.

    I would recommend you to take a look in this thread for NRFX_TWI driver.

    Here is a thread with some explanation regarding nrfx_twi and such, which I recommend you to take a look at.

     

    What pins do you have the sensor connected?

     The default pins are configured in pca10040.h : 

    #define ARDUINO_SCL_PIN             27    // SCL signal pin
    #define ARDUINO_SDA_PIN             26    // SDA signal pin

    Have you connected a scope to check what is going on the bus?

    What kind of sensor is it?

     

     

Reply
  • Hi Harald,

    You are correct that this is not the intended behaviour.

    I would recommend you to take a look in this thread for NRFX_TWI driver.

    Here is a thread with some explanation regarding nrfx_twi and such, which I recommend you to take a look at.

     

    What pins do you have the sensor connected?

     The default pins are configured in pca10040.h : 

    #define ARDUINO_SCL_PIN             27    // SCL signal pin
    #define ARDUINO_SDA_PIN             26    // SDA signal pin

    Have you connected a scope to check what is going on the bus?

    What kind of sensor is it?

     

     

Children
  • Hello Martin,

    I am well aware of the I2C-configuration and how it is handled in the twi_scanner-example.

    For various projects I have been using the nRF52 SDK and I never had trouble with the I2C-communication so far, just until now when I was about to finish the portation from SDK v13.0.0 to SDK v15.0.0.

    So here is the scenario:

    1. I am using the nRF52832-DK with an inertial-sensor connected to the pins 26 and 27, then I run the twi_scanner-example and as a result I see this:

    <info> app: TWI scanner started.
    <info> app: No device was found.

    2. Tried the same thing on the nRF52840-DK with similar results.

    3. I changed the pin-configuration to various different unused gpios to see what is happening but I cant see no change in the behaviour.

    4. When I run the same code from the twi_scanner-example inside my own project-code - where I am able to successfully communicate with the inertial-sensor on any pin I want to - then I see quite the opposite from 1. since it shows available I2C-devices on all 127 I2C-addresses.

    I can insure you I have double checked every available code-line, the migration-guides and pretty much all the problem-topics in the forum regarding a proper I2C-setup with either the legacy-drivers nrf_drv_twi or the new nrfx_twi/nrfx_twim drivers.

    Still I cant figure out what the problem is... maybe I am too blind due to all the code-checking and research.

    The best part is - as a side note - that whenever I flash the twi_scanner-example my UART works, but no matter if I do a full erase or even a recover I am not able to get the UART back running with any ble- or softdevice-related example.

    Again something for the mystery department it seems...

  • Hi Harald,

    •  What specific inertial-sensor do you use?
    • in (1) you are using the unmodified twi_scanner example from SDKv15? Do you get a different result if you try one of the twi_scanner examples from one of the older SDK versions?
    • (4) What modifications do you have for your twi_scanner-example inside your own project code? (is this the code ported from sdk13-15?)

      Could you send your project so I could take a look? What specific Sensor are you connecting to the DK? (I would like to try to reproduce your issue)

    The side note: When you say "with any ble- or softdevice-related example.",(ble stack = softdevice, so if you are going to use ble-examples you have to flash the softdevice) are you pointing to the examples in the SDK? Do you not get any UART data when you run the "ble_app_uart" example?

     

    Best Regards,

    Martin L.

Related