Edbot
me.jpg

Clive's Blog

Hi. I'm Clive Haworth. I'm the CEO of Robots in Schools and I spend some of my time developing the Edbot Software that lets you code your Edbot and Edbot Dream in Scratch, Python, JavaScript and more.

Edbot Software and Bluetooth on Pi


We recently announced Edbot Software support for Stretch, the latest release of Raspbian. Bluetooth seems considerably quicker compared to the older Jessie release, but a few users have reported issues.

I've spent some time looking into this and can now report back my findings.

1. My Pi Model 3B Bluetooth system appears to drop data. This is true for Jessie and Stretch.
2. If enough data packets are dropped the Edbot Software will close the Bluetooth connection and reconnect.
3. This data loss only appears to happen when the Pi is under high load, such as starting up a Chrome browser.

Further investigation revealed lots of errors being reported in the syslog file similar to this:

Bluetooth: hci0: Frame reassembly failed (-84)

The following Web page details the issue:

https://github.com/raspberrypi/linux/issues/2264

Here's a quote from about halfway down the page:


"The rev 1.2 Pi Model 3B lacks the flow control signals to the Bluetooth modem (we ran out of pins), but the rev 1.3 board drops the BT PCM interface and hooks up the flow control. I think what you are seeing is occasional data loss when the FIFOs overflow, something which is hard to avoid in all circumstances."


What this means is that Pi Model 3B rev 1.2 will suffer this issue. If you have a rev 1.3 board then you're lucky and there should be no issue. You can find out the board revision using the following command in a terminal:

$ pinout

pi.png

As you can see, my Pi Model 3B is rev 1.2 - Ouch!!

The solution is to use an inexpensive USB Bluetooth dongle with these boards. The USB interface is reliable and having a dedicated aerial for Bluetooth can only help.

I bought a BCM20702 from Amazon for a few pounds.

dongle.jpg

To use the dongle plug it into a spare USB socket. You'll now have 2 Bluetooth adapters: the new dongle and the built-in adapter. You can check this by typing:

$ sudo hcitool dev

Next you will need to disable the built-in Bluetooth adapter. Edit the file /boot/config.txt as the root user and add the following line to the end of the file:

dtoverlay = pi3-disable-bt

Now reboot your Pi and pair the Bluetooth devices. All should be well!

If you feel you need a little more help please get in touch with us and we'll try and point you in the right direction.