DiddyBorg and Raspberry Pi v2

Further to the conversation we started in https://www.piborg.org/comment/690#comment-690

I have tested the cables and one of them was bad, so i've swapped it out. I've checked that current is getting through the cables I have but we are currently still at the stage of the reverse not being found - do I have a defunct reverse aswell?

pi@raspberrypi ~/diddyborg $ lsmod
Module                  Size  Used by
i2c_dev                 6027  0
snd_bcm2835            18850  0
snd_usb_audio         105630  0
snd_hwdep               5902  1 snd_usb_audio
snd_usbmidi_lib        19617  1 snd_usb_audio
snd_seq_midi            4406  0
snd_seq_midi_event      5375  1 snd_seq_midi
hid_apple               4844  0
snd_rawmidi            18265  2 snd_usbmidi_lib,snd_seq_midi
snd_pcm                75388  2 snd_bcm2835,snd_usb_audio
snd_seq                53078  2 snd_seq_midi_event,snd_seq_midi
snd_seq_device          5628  3 snd_seq,snd_rawmidi,snd_seq_midi
snd_timer              17784  2 snd_pcm,snd_seq
snd                    51667  9 snd_bcm2835,snd_usb_audio,snd_hwdep,snd_timer,snd_pcm,snd_seq,snd_rawmidi,snd_usbmidi_lib,snd_seq_device
pwc                    65979  0
videobuf2_vmalloc       3009  1 pwc
videobuf2_memops        1552  1 videobuf2_vmalloc
videobuf2_core         33578  1 pwc
v4l2_common             5077  2 pwc,videobuf2_core
evdev                   9950  5
joydev                  8903  0
videodev              122487  3 pwc,v4l2_common,videobuf2_core
media                  11577  1 videodev
arc4                    1745  2
rt2800usb              17898  0
rt2800lib              71839  1 rt2800usb
rt2x00usb               8764  1 rt2800usb
rt2x00lib              37292  3 rt2x00usb,rt2800lib,rt2800usb
i2c_bcm2708             4758  0
mac80211              483884  3 rt2x00lib,rt2x00usb,rt2800lib
cfg80211              395310  2 mac80211,rt2x00lib
crc_ccitt               1153  1 rt2800lib
rfkill                 16651  2 cfg80211
uio_pdrv_genirq         2958  0
uio                     8119  1 uio_pdrv_genirq
pi@raspberrypi ~/diddyborg $ ls /dev
autofs           hidraw0  loop6               ppp    ram5     stdout  tty2   tty32  tty45  tty58      v4l     vcsa3
block            hidraw1  loop7               ptmx   ram6     tty     tty20  tty33  tty46  tty59      vc-cma  vcsa4
btrfs-control    hidraw2  loop-control        pts    ram7     tty0    tty21  tty34  tty47  tty6       vchiq   vcsa5
bus              hidraw3  MAKEDEV             ram0   ram8     tty1    tty22  tty35  tty48  tty60      vc-mem  vcsa6
cachefiles       i2c-1    mapper              ram1   ram9     tty10   tty23  tty36  tty49  tty61      vcs     vcsm
char             input    mem                 ram10  random   tty11   tty24  tty37  tty5   tty62      vcs1    vhci
console          kmsg     memory_bandwidth    ram11  raw      tty12   tty25  tty38  tty50  tty63      vcs2    video0
cpu_dma_latency  log      mmcblk0             ram12  rfkill   tty13   tty26  tty39  tty51  tty7       vcs3    xconsole
cuse             loop0    mmcblk0p1           ram13  root     tty14   tty27  tty4   tty52  tty8       vcs4    zero
disk             loop1    mmcblk0p2           ram14  shm      tty15   tty28  tty40  tty53  tty9       vcs5
fb0              loop2    net                 ram15  snd      tty16   tty29  tty41  tty54  ttyAMA0    vcs6
fd               loop3    network_latency     ram2   sndstat  tty17   tty3   tty42  tty55  ttyprintk  vcsa
full             loop4    network_throughput  ram3   stderr   tty18   tty30  tty43  tty56  uinput     vcsa1
fuse             loop5    null                ram4   stdin    tty19   tty31  tty44  tty57  urandom    vcsa2
pi@raspberrypi ~/diddyborg $ sudo i2cdetect -y 1   
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                        
pi@raspberrypi ~/diddyborg $ sudo ./diddySequence.py
Loading PicoBorg Reverse on bus 1, address 44
Missing PicoBorg Reverse at 44
PicoBorg Reverse was not found
Trying bus 0 instead
Loading PicoBorg Reverse on bus 0, address 44
Traceback (most recent call last):
  File "./diddySequence.py", line 15, in 
    PBR.Init()
  File "/home/pi/diddyborg/PicoBorgRev.py", line 264, in Init
    self.Init(False)
  File "/home/pi/diddyborg/PicoBorgRev.py", line 234, in Init
    self.bus = smbus.SMBus(self.busNumber)
IOError: [Errno 2] No such file or directory

This is torture :) I have a 7 year old who has built his bot (https://twitter.com/dchristiansen/status/564040306094399488) but can't bring it to life - please help :)

piborg's picture

The most likely problem would be the cables are not making a good connection.

There are four connections which need to be good for the PicoBorg Reverse to talk over I2C:

  • 3v3 (pin 1)- This is where the controller chip gets power from
  • Ground (pin 6) - This is where the board gets a 0v reference from
  • SDA (pin 3) - This is one of the I2C lines, the connection here needs to be good
  • SCL (pin 5) - This is the other I2C line, the connection here also needs to be good

There is a good reference diagram here: http://pi.gadgetoid.com/pinout/i2c

Pins 1, 3, and 5 share one of the cables.
This cable needs to make good connections on all of the pins, poor connections on the I2C pins can cause the communications to not work properly.

The other cable only carries the ground connection (also known as GND), this needs to be connected for the board to work.
The remaining pins (2 and 4) are not used by the PicoBorg Reverse, however the BattBorg will use them to supply the 5v power to the Raspberry Pi when fitted.

You mentioned before that the on board LED comes on briefly when you connect the power, this means that the code in the control chip is running, it is signalling that it has set itself up and is ready to talk with the Raspberry Pi now.
This suggests it is likely the problem is just a pair of poor cables.

Hopefully we can get this all fixed for you in the next couple of days.

Thanks for getting back to me. Your cables arrived today but i'm afraid there is no change on the raspberry pi 2.

There is however some good news in that it works on my old model b.

Has the reverse been tried/tested on the raspberry pi 2 before ? If not - it seems like there must be some kind of compatibility problem. Can you suggest anything I can do to help diagnose what's going wrong?

The main difference I can see is that the old faithful i2cdetect command finds a device on the old model b, whereas model b v2 returns the clear results I posted earlier.

Not quite sure what they could have changed though, I presume the GPIO pinouts etc are exactly the same as the old model b + ??

Regards
DC

piborg's picture

I am glad to hear the PicoBorg Reverse is now working, that rules out any cable or board problems anyway.

We have had a DiddyBorg running around with a Raspberry Pi v2, there should not be a problem there.

The GPIO pins are the same, although people have been having trouble with getting the GPIO to work.
We found the I2C seems to work normally though.

This might be something we have done differently from each other, here are the steps we took to get DiddyBorg working with the Raspberry Pi v2:

  1. Downloaded the latest Raspbian release (2015-01-31) from:
    http://www.raspberrypi.org/downloads/
  2. Wrote the image to our SD card
  3. Boot the RPi, it should load raspi-config automatically
  4. We then set the following options:
    • 1 - Expand the filesystem
    • 5Enable - Enable the camera
    • 8A4Enable - Enable SSH
    • 8A7Yes × 2 - Enable the I2C modules

    The Raspberry Pi should ask to restart, select Yes

  5. Next we installed the PicoBorg Reverse software:
    bash <(curl https://www.piborg.org/install-picoborgrev.txt)
  6. Then the DiddyBorg code:
    bash <(curl https://www.piborg.org/install-diddyborg.txt)
  7. Next we setup out PS3 controller using this guide:
    http://www.raspians.com/Knowledgebase/ps3-dualshock-controller-install-o...
  8. Then installed the image processing libraries:
    sudo apt-get -y install python-picamera
    sudo apt-get -y install libcv-dev libopencv-dev python-opencv
  9. We then tried to run the full example using
    cd ~/diddyborg
    ./ps3DiddyJoyBall.sh
    but we got an error about RPi.GPIO
  10. We found from the web that the fix was to install the development version according to these instructions:
    http://sourceforge.net/p/raspberry-gpio-python/wiki/install/
    You can find the discussion here:
    http://www.raspberrypi.org/forums/viewtopic.php?f=32&t=98466&p=684028
  11. We tried running DiddyBorg again, he was now up and running the same as with the Raspberry Pi B+

Hopefully we did something you have not done, in which case I would suggest you try that and see if it makes a difference.

There is the possibility the Raspberry Pi itself actually has a fault with its I2C pins, but hopefully it is just a software problem.

Will try tonight and report back!

Thanks!

Thanks for all your help. I have it going now - looks like the rPi 2 I was using had a duff GPIO, tried it on another one and sure enough - lucky number 44 showed up.

Now, on with the programming !!

Cheers again
DC

piborg's picture

I am really glad to hear you have gotten the DiddyBorg working.
Hopefully the programming will be fun instead of problematic ^_^

Sad to hear your Raspberry Pi had a problem in the end though.
Occasionally we all get unlucky I suppose...

Subscribe to Comments for &quot;DiddyBorg and Raspberry Pi v2&quot;