Pinout.xyz icon indicating copy to clipboard operation
Pinout.xyz copied to clipboard

Update pin-8.md

Open axelsimon opened this issue 5 years ago • 12 comments

The sentence ending in "…to achieve a stable." seemed off and prompted me to look into it. After a bit of reading, made a few changes, which i'm submitting here.

Also, "the UART pins are useful" --> "can be useful": setting up over SSH is also an option here, and i think it's better not to make it sound like UART pins are the main option.

axelsimon avatar Dec 03 '20 12:12 axelsimon

Thank you- good catch, however:

IIRC the default UART on Pi 3 and 4 is the miniUART, while the full-blown-hardware-UART is used for Bluetooth.

The dtoverlay=miniuart-bt forces Bluetooth to use the miniUART, giving over the hardware UART to serial and- as I totally failed to complete the sentence - "achieve a stable serial port" or connection or something.

Using miniUART serial kinda works, but in my experience you can't rely on the baudrate to be at all consistent, so anything sensitive to UART stability - flashing a Parallax Propeller or reading a PMS5003 sensor - just goes awry.

The consequence is- in theory- that Bluetooth will now be unstable and unreliable using this overlay, but if a user doesn't plan to use Bluetooth that's academic.

Gadgetoid avatar Dec 03 '20 13:12 Gadgetoid

To be honest, i'm flying a bit by the seat of my pants here, as i didn't know what UART was before today. I tried making sense of it, using this article among others.

Apparently, when using miniUART the baudrate becomes dependent on the CPU speed, which varies, and so the whole thing becomes unreliable.

I also so that this would require an update to pin-10.md to use the same wording, and more probably to uart.md, where some of this could (should ?) live. If you want to sort out the language here, i'm happy to update my PR to reflect that. Let me know what's the best way to proceed :)

axelsimon avatar Dec 03 '20 15:12 axelsimon

As good a time as any to learn! Go for it. And thank you!

Gadgetoid avatar Dec 03 '20 22:12 Gadgetoid

Apparently, when using miniUART the baudrate becomes dependent on the CPU speed, which varies, and so the whole thing becomes unreliable.

Yup, and that's exactly what the enable_uart=1 option fixes - see https://www.raspberrypi.org/documentation/configuration/uart.md for more info.

lurch avatar Dec 04 '20 17:12 lurch

Gotta admit... I'm not quite sure how to move forward with this one, but anything is preferable to a sentence that ends "to achieve a stable." I mean, what is this? A manual for building horse accommodation!?

I think the direction I was going in was "to achieve a stable UART connection" or similar, since the default miniUART is... anything but. FWIW I think serial terminals deal okay with this, though? Normally seems to be a problem when using finicky serial devices like the aforementioned PMS5003.

Perhaps something like:

On the Pi 3 and 4 the full, hardware UART is, by default, used for Bluetooth and the Pi's UART pins are connected to the less stable miniUART. To achieve a stable UART connection to devices, you may need to add "dtoverlay=miniuart-bt" to "/boot/config.txt". This switches Bluetooth over to the miniUART.

But then that's... incomplete. Documentation is tricky!

Gadgetoid avatar Apr 27 '21 12:04 Gadgetoid

@Gadgetoid ah ha, tricky, indeed. I've tried a rewording based on this conversation and your suggestion. Let me know. Yes, documentation, the unsung hero of free and open source software!

axelsimon avatar Apr 27 '21 17:04 axelsimon

LGTM. On the subject of UART documentation being tricky, the RPi docs page that this file links to is currently in the process of being updated too :slightly_smiling_face: https://github.com/raspberrypi/documentation/pull/1849

lurch avatar Apr 27 '21 22:04 lurch

LGTM. On the subject of UART documentation being tricky, the RPi docs page that this file links to is currently in the process of being updated too slightly_smiling_face raspberrypi/documentation#1849

I guess this is pretty good timing and we should maybe probably link to the official documentation too?

Gadgetoid avatar Apr 28 '21 08:04 Gadgetoid

the RPi docs page that this file links to

we should maybe probably link to the official documentation too?

Umm, you already do?! [Raspberry Pi UART documentation](https://www.raspberrypi.org/documentation/configuration/uart.md)

:joy:

lurch avatar Apr 28 '21 09:04 lurch

In my defence I have a streaming cold and all my network hardware is strewn across the living room floor (boiler replacement) so I didn't even double check :laughing:

Gadgetoid avatar Apr 28 '21 11:04 Gadgetoid

Get well soon! :sneezing_face:

lurch avatar Apr 28 '21 13:04 lurch

Unless i'm missing something, i think this is ready to be merged? :)

axelsimon avatar May 05 '21 11:05 axelsimon