tomas
March 11, 2025, 11:34pm
1
I am trying to connect to a GPS receiver through bluetooth using python on my Jetson Orin Nano Developer Kit. Here is the relevant code:
import bluetooth
# bluetooth address of the GPS device.
addr = "20:50:E7:52:1A:DB" # GPS 2
# port to use.
port = 1
# create a socket and connect to the GPS.
socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
while True:
try:
socket.connect((addr,port))
break
except Exception as e:
print("No Socket detected, trying again")
socket.close()
socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
print("GPS Connected")
# MAIN LOOP START
try:
while True:
print("Reading...")
# Receive and save GPS information
val = socket.recv(1024)
data = val.split()
lat_r = float(data[2])
lon_r = float(data[3])
std_lat_r = float(data[8])
std_lon_r = float(data[7])
print("Lat: " + str(lat_r))
print("Lon: " + str(lon_r))
pass
except Exception as e: # if any error on the code , stop robot
print("FATAL ERROR : ")
print(e)
socket.close()
However, when I run the code I get the following message:
_bluetooth.error: (93, 'Protocol not supported')
I have installed both pybluez and libbluetooth-dev.
Hi tomas,
What’s the Jetpack version in use?
Please run the following command to check BT status:
$ sudo service bluetooth status
$ hciconfig
Or check if it could help after installing the following packages:
$ sudo apt-get install --reinstall bluetooth bluez blueman
Please also check if there’s error showed in dmesg.
tomas
March 12, 2025, 4:31pm
4
I’m using Jetpack Version 6.0
Output from bluetooth status
bluetooth.service - Bluetooth service
Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor pre>
Drop-In: /usr/lib/systemd/system/bluetooth.service.d
└─nv-bluetooth-service.conf
Active: active (running) since Wed 2025-03-12 12:10:12 EDT; 7min ago
Docs: man:bluetoothd(8)
Main PID: 636 (bluetoothd)
Status: "Running"
Tasks: 1 (limit: 8814)
Memory: 1.8M
CPU: 76ms
CGroup: /system.slice/bluetooth.service
└─636 /usr/lib/bluetooth/bluetoothd -d --noplugin=audio,a2dp,avrcp
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:load_ltks_comple>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:load_irks_comple>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:load_conn_params>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:set_blocked_keys>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Mar 12 12:10:12 evatech-desktop bluetoothd[636]: src/adapter.c:local_name_chang>
Output from hciconfig
hci0: Type: Primary Bus: USB
BD Address: 1C:CE:51:8E:74:6A ACL MTU: 1021:6 SCO MTU: 255:12
UP RUNNING
RX bytes:1387 acl:0 sco:0 events:89 errors:0
TX bytes:2373 acl:0 sco:0 commands:89 errors:0
Installing the additional packages did not solve the problem.
I ran dmesg, and looked through the output for anything related to the bluetooth. Here’s what I found:
[ 9.521718] Bluetooth: Core ver 2.22
[ 9.529572] NET: Registered PF_BLUETOOTH protocol family
[ 9.529581] Bluetooth: HCI device and connection manager initialized
[ 9.529597] Bluetooth: HCI socket layer initialized
[ 9.529602] Bluetooth: L2CAP socket layer initialized
[ 9.529619] Bluetooth: SCO socket layer initialized
[ 9.597542] input: USB Camera: USB Camera as /devices/platform/bus@0/3610000.usb/usb1/1-2/1-2.2/1-2.2:1.0/input/input11
[ 9.615280] usbcore: registered new interface driver uvcvideo
[ 9.630704] usbcore: registered new interface driver btusb
[ 9.663255] rtk_btusb: Realtek Bluetooth USB driver ver 3.1.6fd4e69.20220818-105856
Here is a text file with the rest of the output if you need it.
dmesg.txt (64.1 KB)
I don’t see any BT related error in your current log.
Please confirm if BT RFCOMM is enabled in your kernel.
$ zcat /proc/config.gz|grep CONFIG_BT_RFCOMM
Could you share the full log when you run your python code?
tomas
March 14, 2025, 3:53pm
6
After running the kernel command
CONFIG_BT_RFCOMM is not set
Full error message
Traceback (most recent call last):
File "/home/evatech/Downloads/290/290b.py", line 8, in <module>
socket = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
File "/home/evatech/.local/lib/python3.10/site-packages/bluetooth/bluez.py", line 165, in __init__
_sock = _bt.btsocket (proto)
_bluetooth.error: (93, 'Protocol not supported')
Could you try to enable it in kernel config(defconfig )?
CONFIG_BT_RFCOMM=y
You can refer to Kernel Customization — NVIDIA Jetson Linux Developer Guide 1 documentation to download/build kernel image.
system
Closed
April 9, 2025, 6:30am
9
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.