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

TWI scanner example stuck at address 0x1 on nRF51 DK board

Hi,

i've got the TWI scanner example flashed onto the NRF51 dk board, using the default "Arduino" pins of P0.07 and P0.30 as SDA/SCL.

I've added two lines to the example code inside the "for each address loop" so that it reads out each address as it checks it, and the code is untouched otherwise.:

				NRF_LOG_INFO("scanning: 0x%x.\r\n", address);
				NRF_LOG_FLUSH(); // helps catch the 0x1 error further down

With nothing plugged in to P0.07 and P0.30, I get on the uart output:

APP:INFO:TWI scanner.
APP:INFO:scanning: 0x1.
APP:INFO:scanning: 0x2.
APP:INFO:scanning: 0x3.
APP:INFO:scanning: 0x4.
APP:INFO:scanning: 0x5.
APP:INFO:scanning: 0x6.
...
...
...
APP:INFO:scanning: 0x7d.
APP:INFO:scanning: 0x7e.
APP:INFO:scanning: 0x7f.
APP:INFO:No device was found.

On a board external to the DK, I have two i2c items on the sda/scl lines - one at address 0x40, and one at 0x38. The external devices is powered through the VDD on the DK board (I've also tried powering it externally, no difference), and the grounds between the external devices and the DK board are connected.

I've tried 5k both ohms and 10k ohms pullups on both the SDA/SCL lines, same deal.

The SDA/SCL lines are also tied to two separate NRF51822 (unpowered) i/o pins, not too sure if that does anything to this test.

If I plug in any single wire (SDA/SCL) into either P0.07 or P0.30, I get:

APP:INFO:TWI scanner.
APP:INFO:scanning: 0x1.

And that's it. It's stuck at 0x1.

The 0x1 line doesn't print if I don't force a flush immediately after printing that line.

Any ideas appreciated.

Parents Reply
  • Ok, I got the debug working by going into Windows control panel -> repair nrf toolkit. Why would a new installation require this step is beyond me.

    Anyways, the debugger does help - it gets stuck at a while loop that it never seems to exit within nrf_drv_twi.marked by the breakpoint. 

    That line of code calls this below, which seemingly returns true all the time (at least 200 times, anyways).

    I'm in the situation where I am away from any of the usual debugging tools, with no oscilloscope and definitely no logic analyzer, so all I have is this debugger and a multimeter.

    Do you have any suggestions on how to proceed? 

    Thanks.

Children
No Data
Related