0

I'm working on a drone project using a mobile phone do send pitch/roll/throttle and yaw to a Rpi 4 2GB over bluetooth. This is no problem. But, then I want to send these values to the flightcontroller using the serial port (UART) (sending a bytearray at baudrate 115200). When run the program I get no errors from the PI, but the flightcontroller won't get any values. Is it at all possible to use BT and UART at the same time on RPi?

8
  • Hi @Svein-Tore Narvestad, Ah, let me see. Let me first summarize your config: (1) Android phone sends pitch/roll/throttle/yaw data to Rpi4B, OK, (2) Now you want Rpi4B to send byteArray data to flight controller, say PixHawk 4, by UART at 115,200 baud. (3) I think it is OK for Rpi4B to talk both BlueTooth and Serial UART at the same time. Of course you can verify my guess by doing the following: (a) Disable Bluetooth connect/pairing, (b) Test Rpi4B to PixHawk4 UART talking. Ah, dinner time. See you late this evening or tomorrow. Cheers. – tlfong01 Nov 4 '19 at 9:08
  • 1
    The information about which modules to use for the serial communication to work properly are missleading, to say the least. I was experimenting a day to get the UART to work, but now the BT is off - still haven't investigated further on this. However, the Pi4 has 4 Uarts, so you might not need to worry about the hasles of the primary one. – PMF Nov 4 '19 at 9:32
  • @PMF, Yes I remember in those old Rpi2 days, you could not use BlueTooth and UART together, and GPIO might affect 3.5 mm audio quality. I thought there is no such restriction on RM3B+ and after. I usually test Rpi on board UART and USB to serial adapter at the same time. And Rpi3B+/Rpi4B BlueTooth is still buggy, so I am not longer seriously using BT and UART at the same time. – tlfong01 Nov 4 '19 at 12:32
  • @PMF how to use the other uarts, I only know about /dev/ttyS0 and I use that. – Svein-Tore Narvestad Nov 4 '19 at 17:46
  • @tlfong01 I'm using flightcontroller KK215. I haven't tried to disabled BT yet, but that my next try. I don't fintd the BT buggy though, that part works perfect. But my android phone is sending every 70msecs, that might be too though? – Svein-Tore Narvestad Nov 4 '19 at 17:51
0

This Answer is misleading, and does not answer the Question. It is possible to use Bluetooth AND serial - use /dev/serial0 If you need to use UART0 it is still possible to use Bluetooth.

According to RPi 4 overlays readme you have to turn off Bluetooth to use UART0. You should test alternative UART pins.

Name: disable-bt

Info: Disable onboard Bluetooth on Pi 3B, 3B+, 3A+, 4B and Zero W, restoring UART0/ttyAMA0 over GPIOs 14 & 15.

N.B. To disable the systemd service that initialises the modem so it doesn't use the UART, use 'sudo systemctl disable hciuart'.

Load: dtoverlay=disable-bt

2
  • OK, summarizing, I can't use BT and uart0 at the same time. Using Uart1 is OK, activating by:Info: Change the pin usage of uart1 Load: dtoverlay=uart1,<param>=<val> Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14) rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15) – Svein-Tore Narvestad Nov 6 '19 at 21:08
  • Finally it works. I'm using uart5 and fixed it with dtoverlay. Unfortunately there was an error in my code. I forgot to change from ttyS0 to ttyAMA1 – Svein-Tore Narvestad Nov 8 '19 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.