BigNeilM
Posts: 25
Joined: Sun Jul 15, 2012 12:45 pm
Location: Cambridge

Think I zapped the on-board serial

Thu Jul 10, 2014 4:51 pm

Hi folks,

I think I have zapped the serial port on two of my Rev 2 boards. GPIO14 and GPIO15 seem to function ok as general IO pins.
I can toggle both of them them on and off as outputs and I can read both high and low from each when they are set as inputs.
Unfortunately, when I try to use them as a serial port (ttyAMA0) they appear to be non-functional. Just to be clear, I have had them working, they just don't work now. I think I accidentally grounded one or other or even both of the pins.
I have made sure that /boot/cmdline.txt has all reference to ttyAMA0 removed and /etc/inittab has the getty command commented out. It just seems odd that the general IO functionality still works and yet the tty which is, after all just a signal switching on and off, albeit quite quickly, does not seem to work any more. Is there something else internally which assists when running as a serial port?

Is there any hope? Or do I just accept that these two will have to be used in situations where the serial port is not required.
Neil Matthews
Lost count how many of As, Bs, APluses, BPluses, Pi2s and now a couple of Zer0s. :-)
Get your E-paper HAT at www.percheron-electronics.uk/shop

User avatar
joan
Posts: 15378
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Think I zapped the on-board serial

Thu Jul 10, 2014 5:25 pm

Interesting.

Is there any activity on the UART gpios when you try to send/receive data?

klricks
Posts: 7551
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Think I zapped the on-board serial

Thu Jul 10, 2014 5:27 pm

Try a 'loopback' test by connecting the TX and RX GPIO together. Then run terminal software such as minicom or cutecom.
Typed characters should echo back to the screen.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6062
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Think I zapped the on-board serial

Thu Jul 10, 2014 5:34 pm

BigNeilM wrote:Hi folks,
I think I have zapped the serial port on two of my Rev 2 boards. GPIO14 and GPIO15 seem to function ok as general IO pins.
I can toggle both of them them on and off as outputs and I can read both high and low from each when they are set as inputs. ...
How do you change their modes to inputs or outputs? (Are you using wiringPi's gpio tool perhaps?)
Are you resetting them back into "alt0" mode?
(If using the gpio utility, how does your gpio readall compare with this:

Code: Select all

pi@raspigrey:~$ gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name   | Mode | Value |
+----------+------+------+--------+------+-------+
|      0   |  17  |  11  | GPIO 0 | OUT  | Low   |
|      1   |  18  |  12  | GPIO 1 | IN   | Low   |
|      2   |  27  |  13  | GPIO 2 | IN   | Low   |
|      3   |  22  |  15  | GPIO 3 | IN   | Low   |
|      4   |  23  |  16  | GPIO 4 | IN   | Low   |
|      5   |  24  |  18  | GPIO 5 | IN   | Low   |
|      6   |  25  |  22  | GPIO 6 | IN   | Low   |
|      7   |   4  |   7  | GPIO 7 | IN   | Low   |
|      8   |   2  |   3  | SDA    | ALT0 | High  |
|      9   |   3  |   5  | SCL    | ALT0 | High  |
|     10   |   8  |  24  | CE0    | ALT0 | High  |
|     11   |   7  |  26  | CE1    | ALT0 | High  |
|     12   |  10  |  19  | MOSI   | ALT0 | Low   |
|     13   |   9  |  21  | MISO   | ALT0 | Low   |
|     14   |  11  |  23  | SCLK   | ALT0 | Low   |
|     15   |  14  |   8  | TxD    | ALT0 | Low   |
|     16   |  15  |  10  | RxD    | ALT0 | High  |
|     17   |  28  |   3  | GPIO 8 | ALT2 | Low   |
|     18   |  29  |   4  | GPIO 9 | ALT2 | Low   |
|     19   |  30  |   5  | GPIO10 | ALT2 | Low   |
|     20   |  31  |   6  | GPIO11 | ALT2 | Low   |
+----------+------+------+--------+------+-------+
for a working serial connection?)
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

BigNeilM
Posts: 25
Joined: Sun Jul 15, 2012 12:45 pm
Location: Cambridge

Re: Think I zapped the on-board serial

Thu Jul 10, 2014 11:44 pm

joan wrote:Interesting.

Is there any activity on the UART gpios when you try to send/receive data?
I haven't tried hanging an oscilloscope on the pins. Something to try, I guess.
Neil Matthews
Lost count how many of As, Bs, APluses, BPluses, Pi2s and now a couple of Zer0s. :-)
Get your E-paper HAT at www.percheron-electronics.uk/shop

BigNeilM
Posts: 25
Joined: Sun Jul 15, 2012 12:45 pm
Location: Cambridge

Re: Think I zapped the on-board serial

Thu Jul 10, 2014 11:45 pm

klricks wrote:Try a 'loopback' test by connecting the TX and RX GPIO together. Then run terminal software such as minicom or cutecom.
Typed characters should echo back to the screen.
Yeah, tried that. Works for the unzapped units and does nothing on the zapped ones.
Neil Matthews
Lost count how many of As, Bs, APluses, BPluses, Pi2s and now a couple of Zer0s. :-)
Get your E-paper HAT at www.percheron-electronics.uk/shop

BigNeilM
Posts: 25
Joined: Sun Jul 15, 2012 12:45 pm
Location: Cambridge

Re: Think I zapped the on-board serial

Fri Jul 11, 2014 12:11 am

FTrevorGowen wrote:
BigNeilM wrote:Hi folks,
I think I have zapped the serial port on two of my Rev 2 boards. GPIO14 and GPIO15 seem to function ok as general IO pins.
I can toggle both of them them on and off as outputs and I can read both high and low from each when they are set as inputs. ...
How do you change their modes to inputs or outputs? (Are you using wiringPi's gpio tool perhaps?)

Using RPi.GPIO and GPIO.setup(15, GPIO.IN) and such.

Are you resetting them back into "alt0" mode?

No, do I have to? If so, how?

(If using the gpio utility, how does your gpio readall compare with this:

Code: Select all

pi@raspigrey:~$ gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name   | Mode | Value |
+----------+------+------+--------+------+-------+
|      0   |  17  |  11  | GPIO 0 | OUT  | Low   |
|      1   |  18  |  12  | GPIO 1 | IN   | Low   |
|      2   |  27  |  13  | GPIO 2 | IN   | Low   |
|      3   |  22  |  15  | GPIO 3 | IN   | Low   |
|      4   |  23  |  16  | GPIO 4 | IN   | Low   |
|      5   |  24  |  18  | GPIO 5 | IN   | Low   |
|      6   |  25  |  22  | GPIO 6 | IN   | Low   |
|      7   |   4  |   7  | GPIO 7 | IN   | Low   |
|      8   |   2  |   3  | SDA    | ALT0 | High  |
|      9   |   3  |   5  | SCL    | ALT0 | High  |
|     10   |   8  |  24  | CE0    | ALT0 | High  |
|     11   |   7  |  26  | CE1    | ALT0 | High  |
|     12   |  10  |  19  | MOSI   | ALT0 | Low   |
|     13   |   9  |  21  | MISO   | ALT0 | Low   |
|     14   |  11  |  23  | SCLK   | ALT0 | Low   |
|     15   |  14  |   8  | TxD    | ALT0 | Low   |
|     16   |  15  |  10  | RxD    | ALT0 | High  |
|     17   |  28  |   3  | GPIO 8 | ALT2 | Low   |
|     18   |  29  |   4  | GPIO 9 | ALT2 | Low   |
|     19   |  30  |   5  | GPIO10 | ALT2 | Low   |
|     20   |  31  |   6  | GPIO11 | ALT2 | Low   |
+----------+------+------+--------+------+-------+
for a working serial connection?)
Trev.
OK, using 'gpio mode pin alt0' (pin has to be wiringPi pin, not BCM pin) I have got them back to ALT0 mode and now the com port echoes back in cutecom when I link tx to rx. Thanks for that, but it's a bit obscure. Is there a way to set mode back using RPi.GPIO rather than wiringPi? You can set IN or OUT but ALT0 does not seem to be an obvious option.
Neil Matthews
Lost count how many of As, Bs, APluses, BPluses, Pi2s and now a couple of Zer0s. :-)
Get your E-paper HAT at www.percheron-electronics.uk/shop

User avatar
joan
Posts: 15378
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Think I zapped the on-board serial

Fri Jul 11, 2014 7:32 am

I don't think RPi.GPIO currently supports the setting of any modes other than INPUT and OUTPUT.

Is this a problem in practice? Why will you be switching them out of ALT0 mode?

BigNeilM
Posts: 25
Joined: Sun Jul 15, 2012 12:45 pm
Location: Cambridge

Re: Think I zapped the on-board serial

Fri Jul 11, 2014 8:12 am

joan wrote:I don't think RPi.GPIO currently supports the setting of any modes other than INPUT and OUTPUT.

Is this a problem in practice? Why will you be switching them out of ALT0 mode?
As evident by my original posting, it is possible to somehow find pins NOT in ALT0 mode at which point they cease to perform their 'special' function, like serial port for example. Does it also mess up SPI and I2C functions if relevant pins are not set to ALT0? My bet is 'Yes'. It therefore would be handy if this fact were well documented, with clear instructions on how to check and rectify it if things go awry. People will experiment and it seems that once you use a gpio pin for something other than it's 'special' function it's mode will be changed from ALT0 to IN or OUT or whatever and it will no longer perform its 'special' function until changed back to ALT0, so I'd say it IS important.
Neil Matthews
Lost count how many of As, Bs, APluses, BPluses, Pi2s and now a couple of Zer0s. :-)
Get your E-paper HAT at www.percheron-electronics.uk/shop

User avatar
joan
Posts: 15378
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Think I zapped the on-board serial

Fri Jul 11, 2014 8:31 am

I don't remember this cropping up before so I'd take issue with it being important.

You can't caution every action which might lead to a misleading situation.

User avatar
FTrevorGowen
Forum Moderator
Forum Moderator
Posts: 6062
Joined: Mon Mar 04, 2013 6:12 pm
Location: Bristol, U.K.
Contact: Website

Re: Think I zapped the on-board serial

Fri Jul 11, 2014 8:42 am

BigNeilM wrote:
joan wrote:I don't think RPi.GPIO currently supports the setting of any modes other than INPUT and OUTPUT.
Is this a problem in practice? Why will you be switching them out of ALT0 mode?
As evident by my original posting, it is possible to somehow find pins NOT in ALT0 mode at which point they cease to perform their 'special' function, like serial port for example. Does it also mess up SPI and I2C functions if relevant pins are not set to ALT0? My bet is 'Yes'. It therefore would be handy if this fact were well documented, with clear instructions on how to check and rectify it if things go awry. People will experiment and it seems that once you use a gpio pin for something other than it's 'special' function it's mode will be changed from ALT0 to IN or OUT or whatever and it will no longer perform its 'special' function until changed back to ALT0, so I'd say it IS important.
Having re-visited the "original" low-level GPIO support documentation at http://elinux.org/Rpi_Low-level_periphe ... e_examples I suspect that the python RPi.GPIO stuff may be (in some part) "wrappers" around 'C' code (including bits of "wiringPi"?). Digging deeper I've found the (new) location of the authors wiki at http://sourceforge.net/p/raspberry-gpio ... wiki/Home/ . If you haven't seen that it may be worth a visit and is probably a better place to comment further. wiringPi's 'C' - based gpio tool is very well documented, and very easy to use.
Trev.
Still running Raspbian Jessie or Stretch on some older Pi's (an A, B1, 2xB2, B+, P2B, 3xP0, P0W, 2xP3A+, P3B+, P3B, B+, and a A+) but Buster on the P4B's & P400. See: https://www.cpmspectrepi.uk/raspberry_pi/raspiidx.htm

Return to “Troubleshooting”