dublevsky
Posts: 3
Joined: Sun Dec 09, 2018 6:53 pm

UART0, UART1, Blutetooth and WiFi interaction on Raspberry Pi 3 Model B+

Sun Dec 09, 2018 7:11 pm

First of, sorry if I've chosen the wrong subforum.

I'm writing a hobbyist OS kernel and want to clarify a few things before I go on with the implementation of UARTs drivers and general IO design.

Q1: Can I use ANY pins for miniUART/PL011 UART specified in the 'BCM2835 ARM Peripherals' document as TXD0/RDX0 & TXD1/RXD1?
Q2: Can I initialize and use BOTH miniUART and PL011 UART at the same time interchangeably?
Q3: What is the relationship between UART0, UART1 and BL/WiFi module? What I want to know is exactly what things need to be initialized/reinitialized for EACH of those to be working. For example, https://www.raspberrypi.org/documentati ... on/uart.md says that PL011 UART is connected to the Bluetooth module. If I understood correctly, I can make the Bluetooth module use miniUART, while using PL011 as my main UART, but this will bring all the downsides of miniUART.

Please let me know how exactly these, mentioned in the title, interact and if I should be aware of some caveats.

Schnoogle
Posts: 48
Joined: Sun Feb 11, 2018 4:47 pm

Re: UART0, UART1, Blutetooth and WiFi interaction on Raspberry Pi 3 Model B+

Thu Dec 13, 2018 12:41 pm

Hi dublevsky,

whether you are on the right forum o not depends on whether you are planning to do baremetal implementation or just building applications on top of Linux.
Assuming this forum is the right place for you and you are planning to do some baremetal stuff I might be able to share some of my experiences with you:
A1: as far as I'm aware you could use any of the GPIO pins marked as TXD0/RXD0 for miniUart and TXD1/RXD1 for PL011 UART using the respective alternate function on those pins

A2: you can run both UART's at the same time for their specific purpose but not "interchangeably". So using miniURT for console and PL011 for bluetooth for example. As far as I'm aware there is no option to use miniUART for bluetooth.

A3: from my experience I'm using PL011 to communicate with the built-in bluetooth adapter. Setting GPIO32 and 33 to their alt function 3 enables the UART-BT bridge. As far as I'm aware you need to configure the UART to use 115200 Baud for the bridge to work properly. Also enable the UART using FIFO and trigger interrupts that could handle inbound traffic. To use and initialize the BT device you just write the data to the PL011 UART device. However, they need to be written/send in a specific format that the BT device is able to intepret. This is the BT-HCI format. You may find documentation on this format in the net :). To get the BT functioning you would send a HCI Reset command and than load the BT firmware to the device with a HCI Firmware-Load command. Based on the PI model this firmware is available in a github repository: https://github.com/RPi-Distro/bluez-fir ... r/broadcom use BCM4345C0.hcd for Pi3B+ and BCM43430A1.hcd for Pi3. From this onward you could further setup BT using the differemt HCI commands to set master/slave, set device name etc. and handle inbound connection requests...

Hope this helps a bit...
BR
Schnoogle

dublevsky
Posts: 3
Joined: Sun Dec 09, 2018 6:53 pm

Re: UART0, UART1, Blutetooth and WiFi interaction on Raspberry Pi 3 Model B+

Fri Dec 14, 2018 7:01 pm

Thank you very much, Schnoogle, for your in-depth reply!

Return to “Bare metal, Assembly language”