Using Debug UART


(Thomas Linke) #1

Can anyone explain me how to use the debug uart un the R2?

I connected a PC via usb2serial with different line speeds, changed RX/TX cables several times but no success. What am I doing wrong?

Thanks much

Thomas


BPI-R2 New image : Openwrt/LEDE 2017-09-08
(Frank W.) #2

which application and which settings (speed,stopbit,parity) do you use on pc? Maybe its configuration is wrong. Which cable?


(Manuel Roeder) #3

115200 baud 8 data bits 1 stop bit should be fine, you will only see something if you put a sdcard in the slot (including bpi-r2 image) and press powerbutton for a short period of time. If you use a pl2303 serial usb converter and a windows pc you could get problems with the driver.


(Thomas Linke) #4

I have connected the gnd pin to pin 5 of a db9 plug. pin tx and rx to pins 2 and 3 (which I have exchanged several times). 115200 8n1 is set in minicom. I use a Notebook with debian Jessie with a usb2serial Adapter (because of the driver problems in Windows 10)

Still nothing coming out on screen. What should come out? Syslog? Console session?

Edit: While restarting the R2 i just saw som weird characters as if transmission parameters might be wrong. Where on the R2 can i configure the line speed?

Thanks for your help :slight_smile:


(Thomas Linke) #5

In the meanwhile I found out a couple of things: 115200 8n1 seems to be correct. I see weird characters in Minicom which look like the wrong speed. But if the line speed is correct, I make another mistake. Or is ist possible that these Characters are just chinese? (which my notebook cannot display???)

Edit: I just saw something funny

root@supernane:~# setserial /dev/ttyS0 -a /dev/ttyS0, Line 0, UART: 16650V2, Port: 0x0000, IRQ: 30 Baud_base: 1625000, close_delay: 50, divisor: 0 closing_wait: 3000 Flags: spd_normal

Any help is greatly appreciated :slight_smile:


(Frank W.) #6

i have debug-uart running with this minicom-options (german localized):

| A - Serieller Anschluss : /dev/ttyUSB0 | => changed

| B - Pfad zur Lockdatei : /var/lock |

| C - Programm zur Rufannahme : |

| D - Programm zum Wählen : |

| E - Bps/Par/Bits : 115200 8N1 | => should be default

| F - Hardware Flow Control : Nein | => NO

| G - Software Flow Control : Nein | => NO


(Manuel Roeder) #7

wrong characters may be a contact problem. Please use a least a level-shifter (max233) for standard com-port or the mentioned usb serial converter.


(Frank W.) #8

Usb-adapters do not need an levelshifter,right?


(Manuel Roeder) #9

Yes, you need the level-shifter only if you use old standard com-port (9-pin sub-d connector).


(Manuel Roeder) #10

The easiest program to use is putty - it runs using windows or linux …


(Thomas Linke) #11

Hello again.

As we all know, most of the time the Problem sits right next to the keyboard. I did something terribly wrong: As I thought 8 GB might be a bit too small, I moved /var /home and /usr to harddisk partitions which was perfectly okay when I was a youg guy. But since we have systemd, the /usr directory is needed by systemd in the early boot phase when no disks are mouted yet. Didn’t know that.

Okay - my fault - new install.

But still I do not get the debug port working. I think it should work out of the box with 115200 8n1. With my setup - usb2serial cable I didn’t ever need a level-shifter neither for Pi’s nor Arduinos. Whatever I try, I only see character-salad on Minicom or putty.

Is there anything else I could try?


(Frank W.) #12

Debug-UART displays also something on bootphase before accessing the SD-Card (see my logs in my last posts)…all 3 Pins on that r2-header (not the 40pig GPIO) must be connected

have you connected gnd, too???

debug-uart was working on my board without problems (usb-adapter used under ubuntu, 3 Pins connected, tx=>rx,rx<=tx)


(Thomas Linke) #13

Yes, all 3 Pins are connected. TX -> Pin2, RX -> Pin3, gnd -> Pin5

While booting, I can see a whole lot of garbage scrolling on the screen. I even tried a different serial2USB stick. No change!

But wait!!! I have the latest Ubuntu Image. Could it simply be “Chinese”???


(Frank W.) #14

does your BPI-R2 run? (green led stay on)

image on SD does not matter, because you should get messages from bootloader (in english)…

i did the same as i did with an raspberry (1), and it works…if you have one you can try with that and change only the board/pins


(Thomas Linke) #15

The R2 runs like a charm, I’m connected via ssh. :slight_smile:

The setup works with Raspi’s, Oranges, Arduinos and my Banana pro as well.

On the other Side of the serial2USB I have an elderly Notebook with Debian Wheezy

Is there any serial configuration about the Bootloader? I could take a look?


(Frank W.) #16

maybe you can/haveto re-flash bootloader…have done this before?

but be careful,this step can brick your device.

As i said, my r2 works out-of-the-box regarding debug-uart


(Thomas Linke) #17

Nope, never did that before, and I don’t think it is a good idea. A serial console certainly is nice to have but I would’nt go any risks for having it. Maybe future images have a different serial behaviour :slight_smile:

But anyway, Thank you very much for your help. I really felt like a complete noob in this case (which I’m normally not) :smiley:


(Frank W.) #18

again, the image on SD is independent from debug-UART on R2…later you set env-Vars to change this behaviour, but uart should work at least till first read of SD-card to debug Problems before that

bpi-r2 has a nice boot-menu you can select emmc-start (empty on my r2 so i did not tried it out).

now i’m out of my knowledge, maybe some tech (gary,sinovoip) can give an hint


(Thomas Linke) #19

That sounds interesting but I’m afraid I won’t ever get to see that menu :frowning:

In the meanwhile I tried a different Notebook (just to make sure) and i played with stty. It seems to me that something in the background works as if it was a login prompt (not readable however) but i can enter something and there is some kind of response.

I just started the r2 without SD-Card and without harddisk and ttyS0 didn’t do anything.


(Frank W.) #20

you use the right usb-device? as i remember some systems (rpi outgoing) create a ttyAMAx/ttyACMx-device which is same HW, but different driver. but if rpi works…i use same cable/settings/application


Temporary fix to get SATA SSD working using /etc/fstab on R2