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

twi_scanner example only returning address 0x01

I have set up a custom board using the nRF52811 based BMD-360 module.

I have tested the twi_scanner example, first of the nrf52DK with an external sensor. I Changed the TWI pins to the ones I am using on the custom board (SCL: 26, SDA: 25) and verified it worked as expected returning the address of the sensor over UART.

I have set up a custom board using the nRF52811 based BMD-360 module, and modified the project to target the nrf52811 (extracted settings from a PCA10056e project and changed the target, etc.). The program compiles fine and runs. My custom board doesn't have a serial output, so I have placed breakpoints to check for any detected devices. 

I only seem to be detecting one device on address 0x01, regardless of if I have a sensor attached to the board or not. I have tried the same sensor as I used with the DK connected, and still get the same result.

I have pull-ups on the TWI lines and nothing else on the bus so I don't think it's a hardware issue. I think it may just be a configuration problem moving from the nRF52840 DK to the nRF52811?

Any help would be appreciated.

(Using nRF5 SDK16.0.0)

Parents Reply Children
  • Thanks for your reply Margeris.

    My preprocessor defines

    BOARD_PCA10056
    BSP_DEFINES_ONLY
    CONFIG_GPIO_AS_PINRESET
    FLOAT_ABI_SOFT
    INITIALIZE_USER_SECTIONS
    NO_VTOR_CONFIG
    NRF52811_XXAA

    Linker:

    FLASH_PH_START=0x0 
    FLASH_PH_SIZE=0x30000
    RAM_PH_START=0x20000000
    RAM_PH_SIZE=0x6000
    FLASH_START=0x0
    FLASH_SIZE=0x30000
    RAM_START=0x20000000
    RAM_SIZE=0x6000

    Other setup:

    For the record, that guide does not cover everything necessary and in enough detail. It took me hours to figure out how to transfer the project before using a PCA100056e example. It doesn't mention the soft FPU change required in SES's Code generation section/preprocessor define at all, and the linker script settings are exceptionally confusing when all the IDEs use different approaches. To save others time and frustration I think it's really worth updating.

    Registers:

    I'll hopefully get a chance to check on a scope later today.

  • @msromero, Still no luck getting this to work, but I am seeing I2C waveforms on the scope on the correct pins.

    This returns a device found at address 0x01 for some reason:

    It looks like when I address the LSM303DLHC sensor I'm using to test it does provide a I2C response:

    For whatever reason it's not picking this up in software. Any ideas?

  • Hi,

    Sorry for the late reply. When SDA remains HIGH during the ninth clock pulse, the signal is defined as a NACK. But you say you are reading it as being a device found at address 0x01? Can you explain more about how you are checking the result?
    BR,
    Marjeris
  • Yes,I I'm confused by this too. The fact it completely ignored an ACK response from the device doesn't make sense.

      I'm using the twi_scanner example straight out of the box, other than making the changes shown above to port it to the 52811. Since this works on the nrf52 DK possibly it's something to do with the porting process? I'm using a module (bmd360) but judging by the i2c waveforms that's still all working as expected.

Related