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
  • Hi,

    Have you tried using other pins? P0.07 on the nRF51 DK is by default used for the CTS UART HW flow control line and connected to the interface MCU.

    Did you debug the application, to see if it is only the log that does not output, or if the application crashes?

    Best regards,
    Jørgen

  • Hi,

    Yes, I've gone around and tried many pairs of pins. All the same behavior. What else do you suggest I try?

    To address your second point, Keil has been having issues with debugging and flashing. I've never gotten it to work quite right. This happens 90% of the time I try: (Update: I've managed to fix the Keil issue and can do debugging now. Will try to add a debug log output shortly).

    I've went through most of the options here:

    When I just try to flash the code, sometimes Keil wants to connect to the nrf51-dk board and "download" the code, but I just go through nRF connect to do the flashing.

    Thanks.

Reply
  • Hi,

    Yes, I've gone around and tried many pairs of pins. All the same behavior. What else do you suggest I try?

    To address your second point, Keil has been having issues with debugging and flashing. I've never gotten it to work quite right. This happens 90% of the time I try: (Update: I've managed to fix the Keil issue and can do debugging now. Will try to add a debug log output shortly).

    I've went through most of the options here:

    When I just try to flash the code, sometimes Keil wants to connect to the nrf51-dk board and "download" the code, but I just go through nRF connect to do the flashing.

    Thanks.

Children
No Data
Related