Jos1
Posts: 2
Joined: Tue May 14, 2019 11:21 am

BLE C program works on a RPi3B+, not on another one

Tue May 14, 2019 11:29 am

I wrote a C program to read weights via BLE from an
electronic scale. It worked fine. Than I put the SD
card in another RPi3B+ and it did not function
correctly. It connected to the scale, but gives
an error message when calling gattlib_connect.

Note: the SD card was the same in both RPis.

Any idea of the cause? Are there BLE settings inside
a RPi, which are not on the SD card?

Thanks!
Jos
Last edited by Jos1 on Wed May 15, 2019 11:52 am, edited 1 time in total.

User avatar
Douglas6
Posts: 4666
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: BLE C program works on a RPi3B+, not on another one

Tue May 14, 2019 6:05 pm

Were they both Rpi3Bs? Firmware and capabilities may differ between the onboard chip and an USB adapter. Also, of course, the Bluetooth device address will be different between Pis, and that will affect pairings and such.

Perhaps the complete error message would help someone here?

Jos1
Posts: 2
Joined: Tue May 14, 2019 11:21 am

Re: BLE C program works on a RPi3B+, not on another one

Wed May 15, 2019 11:51 am

Thanks for your answer. In the mean time I solved the problem.

The problem was solved by changing the MAC address of the different RPi 3B+ into the
one of the RPi 3B+ on which the program worked. I used this post for this:

https://scribles.net/changing-a-bluetoo ... pberry-pi/

Apparently an SD card is tied to a certain Bluetooth device MAC address, i.e., to a
certain RPi.

Return to “Advanced users”