Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • Re: How to restore Serial pins in Python

$
0
0
Can you not use different GPIOs for your different task?

In bookworm, run the utility pinctrl after boot, and notice the states of GPIO14/15. After you have finished with Python, you should be able to restore the pins using something like pinctrl set 14 a5 pn and pinctrl set 15 a5 pu.

The a (alternate function) numbers are specific to the model of Pi and the UART you have configured, so you must get these from the earlier pinctrl output. Most models cannot read back the pull directions, but I think 14 pn and 15 pu are correct.

The information is passed from the firmware to the kernel at boot using device-tree. Again, it would be better if you could leave the automatically configured pins alone.

Statistics: Posted by jojopi — Fri Jan 03, 2025 8:12 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles