Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pin-8.md #393

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update pin-8.md #393

wants to merge 2 commits into from

Conversation

axelsimon
Copy link

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.

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.
@Gadgetoid
Copy link
Collaborator

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.

@axelsimon
Copy link
Author

axelsimon commented Dec 3, 2020

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 :)

@Gadgetoid
Copy link
Collaborator

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

@lurch
Copy link
Contributor

lurch commented Dec 4, 2020

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.


UART can be used to talk to Serial GPS modules or sensors such as the PM5003, but you must make sure you disable the Serial Console in raspi-config first.

On the Pi 3 and 4 the UART is, by default, used for Bluetooth and you may need to add "dtoverlay=miniuart-bt" to "/boot/config.txt" to achieve a stable.
On the Pi 3 and 4 the UART is, by default, used for Bluetooth and you may need to add "dtoverlay=miniuart-bt" to "/boot/config.txt" to be able to use UART (although a reduced version, mini UART).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also the Pi Zero W

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah the pitfall of mentioning any specific Pi... the list is getting too darn long!

@Gadgetoid
Copy link
Collaborator

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!

Using @Gadgetoid's wording and explanations.
@axelsimon
Copy link
Author

@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!

@lurch
Copy link
Contributor

lurch commented Apr 27, 2021

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 🙂
raspberrypi/documentation#1849

@Gadgetoid
Copy link
Collaborator

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?

@lurch
Copy link
Contributor

lurch commented Apr 28, 2021

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)

😂

@Gadgetoid
Copy link
Collaborator

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 😆

@lurch
Copy link
Contributor

lurch commented Apr 28, 2021

Get well soon! 🤧

@axelsimon
Copy link
Author

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

@@ -1,11 +1,13 @@
This pin doubles up as the UART transmit pin, TX. It's also commonly known as "Serial" and, by default, will output a Console from your Pi that, with a suitable Serial cable, you can use to control your Pi via the command-line.
This pin doubles up as the UART transmit pin, TX. It's also commonly known as "Serial" and, by default, will output a Console from your Pi that, with a [suitable Serial cable](https://elinux.org/RPi_Serial_Connection), you can use to control your Pi via the command line.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might not actually be the default behaviour any more (because it requires setting the SoC to a fixed clockspeed, rather than letting it turbo on demand), and you need to explicitly request this functionality using raspi-config?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that so? I don't mind lying temporarily to get this merged, and then figuring this out after the fact.

I uh... have been very, very deep in RP2040 lately so my Pi know-how is rusty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that so? I don't mind lying temporarily to get this merged, and then figuring this out after the fact.

See https://www.raspberrypi.com/documentation/computers/configuration.html#interfacing-options and https://www.raspberrypi.com/documentation/computers/config_txt.html#enable_uart
(although this is often a moving target, and unfortunately the documentation isn't always kept up to date with the changes in Raspberry Pi OS)

I uh... have been very, very deep in RP2040 lately so my Pi know-how is rusty.

Nice! 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants