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?
Asked
Active
Viewed 2,441 times
1 Answers
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
-
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,=
Params: txd1_pin GPIO pin for TXD1 (14, 32 or 40 - default 14)
– Svein-Tore Narvestad Nov 06 '19 at 21:08rxd1_pin GPIO pin for RXD1 (15, 33 or 41 - default 15)
-
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 08 '19 at 21:10
dtoverlay=uart2
, see /boot/overlays/README. – PMF Nov 04 '19 at 19:39