This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Kernel debug. Using the UART
#1
Hello forum,

I'd like to see some debug over the serial port during the kernel booting , but I saw some strange behavior. Perhaps I need more information.

I was trying to connect RX-TX-GND (9, 15, 13 pins respectively) to a USB-RS232 interface that is built with PL2303 and is working for 5 or 3.3 Volts. So I wanted to have the device ready with the terminal program running prior to power up the TB. But I see the red LED at the side of the microUSB lighting up. So I stopped any operation.

So, what could be the right operations to prepare the reading on the serial port when the kernel is booting? And which of the 4 UART is concerned and what's the baud rate ?
Reply
#2
Hi Im4Tinker

1. [TB] modify /boot/extlinux/extlinux.conf
"append earlyprintk quiet splash plymouth.ignore-serial-consoles console=tty1 rw init=/sbin/init"
to
"append earlyprintk quiet splash plymouth.ignore-serial-consoles console=tty1 console=ttyS4,115200n8 rw init=/sbin/init"

2. [TB]set "intf:uart4=on" at /boot/hw_intf.conf
3. [TB] $>sudo reboot   //reboot device
3. [Host]sudo minicom -D /dev/ttyUSB0 -b 115200
[-] The following 2 users Like scorpiochang's post:
  • Im4Tinker, lftr
Reply
#3
Thanks for the info. I was thinking to have to do with the kernel line. Your information clarified most of the doubts.
What about the current flowing through the pins. Is there any precautions?
Reply
#4
Is it safe to plug the RS232 interface prior supplying the Tinker Board?
As I mention, there's the power LED coming up if I connect the RX pin. Is this regularly happen?
Reply
#5
Hi Im4Tinker

What about the current flowing through the pins. -->3.3V
i think TinkerBoard and your device should have circuit protection design, and even you plug/unplug some pins of UART, it just case some protocol issue at TinkerBoard side, restarting bus or device can solve issue.
Reply
#6
Oops! The TX device pin gives out 5.05 Volts. I'm going to arrange an opto-isolated connection Wink
Reply
#7
I'm back with some disappointment.
I used a little precaution and I add one  2.2KOhm resistor in series to the TX-RX lines, to prevent any bad.

Whatever I tried to get data from, it didn't give any sign of life.
I've set ttyS4, but nothing seen over the pins. Even the oscilloscope shows a brief period going high then low, but really nothing to resemble a serial transmission.
Got back to defaulted ttyS2, but with the same result.
Tried to loopback the TX on RX, but no sign of anything. Both UART2 and UART4. I didn't try for UART3 and UART1, yet, but I feel that will be the same soup.
I've tried picocom and minicom. The picocom says that there's no tty on the ttyS2 or ttyS4.

How am I suppose to test whether there's something working on the GPIOs ?
Reply
#8
Hi Im4Tinker

I've tried picocom and minicom. The picocom says that there's no tty on the ttyS2 or ttyS4.
-->if you use USB to TTL device connecting host PC and TinkerBoard( https://www.amazon.com/Armorview-PL2303H...B008AGDTA4 ), you should use /dev/ttyUSBx to communicate with Tinkerboard on host PC, not ttyS2 and ttyS4.

How am I suppose to test whether there's something working on the GPIOs ?
-->please update gpio_lib_c (https://github.com/TinkerBoard/gpio_lib_c), and use command "gpio readall" to check GPIO5B6 and GPIO5B7 are mode SERL or not.
if settings are correct, use minicom by "sudo minicom -D /dev/ttyUSB0 -b 115200" on host PC
then try "echo -e hello > /dev/ttyS4" on TinkerBoard. you should see "hello" on minicom shell on host PC.
Reply
#9
I did some test by picocom. I found ttyS0 available,  but unusable. About ttyS2 picocom says
Code:
FATAL: failed to add port: Filedes is not a tty
ttyS1, ttyS3 and ttyS4 are working.
Then  I tested with crossing their RX-TX and  the terminal shows the character transmitted.
Here's
Code:
$ gpio readall
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
|     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
| 252 |   8 |   SDA.1 |  I2C | 1 |  3 || 4  |   |      | 5v      |     |     |
| 253 |   9 |   SCL.1 |  I2C | 1 |  5 || 6  |   |      | 0v      |     |     |
|  17 |   7 | GPIO0C1 |   IN | 1 |  7 || 8  | 1 | SERL | TxD.1   | 15  | 161 |
|     |     |      0v |      |   |  9 || 10 | 1 | SERL | RxD.1   | 16  | 160 |
| 164 |   0 |  CTSN.4 | SERL | 1 | 11 || 12 | 0 | I2S  | I2S_CLK | 1   | 184 |
| 166 |   2 |   TxD.4 | SERL | 1 | 13 || 14 |   |      | 0v      |     |     |
| 167 |   3 |   RxD.4 | SERL | 1 | 15 || 16 | 1 | SERL | CTSN.1  | 4   | 162 |
|     |     |    3.3v |      |   | 17 || 18 | 1 | SERL | RTSN.1  | 5   | 163 |
| 257 |  12 |  MOSI.2 |  SPI | 0 | 19 || 20 |   |      | 0v      |     |     |
| 256 |  13 |  MISO.2 |  SPI | 1 | 21 || 22 | 0 | IN   | GPIO5C3 | 6   | 171 |
| 254 |  14 |  SCLK.2 |  SPI | 1 | 23 || 24 | 1 | SPI  | CE0.2   | 10  | 255 |
|     |     |      0v |      |   | 25 || 26 | 1 | SPI  | CE1.2   | 11  | 251 |
| 233 |  30 |   SDA.4 |  I2C | 1 | 27 || 28 | 1 | I2C  | SCL.4   | 31  | 234 |
| 165 |  21 |  RTSN.4 | SERL | 1 | 29 || 30 |   |      | 0v      |     |     |
| 168 |  22 | GPIO5C0 |   IN | 1 | 31 || 32 | 1 | PWM  | PWM.3   | 26  | 239 |
| 238 |  23 |   PWM.2 |  PWM | 1 | 33 || 34 |   |      | 0v      |     |     |
| 185 |  24 |  I2S_FS |  I2S | 0 | 35 || 36 | 1 | SERL | RxD.3   | 27  | 223 |
| 224 |  25 |   TxD.3 | SERL | 1 | 37 || 38 | 1 | I2S  | I2S_SDI | 28  | 187 |
|     |     |      0v |      |   | 39 || 40 | 0 | I2S  | I2S_SDO | 29  | 188 |
+-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
| CPU | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | CPU |
+-----+-----+---------+------+---+--Tinker--+---+------+---------+-----+-----+
But no GPIO5B6~7
Code:
$ gpio readall |grep GPIO5B6
$ gpio readall |grep GPIO5B7

No answers.

But I refrain that during boot time, I couldn't see any kind of serial transmissions from UART4 and UART2 (pin 13~15 and 32~33, respectively). Even I probed by the oscilloscope.
Code:
$ uname -srvo
Linux 4.4.103+ #1 SMP Fri Jun 22 16:14:49 CST 2018 GNU/Linux

About the converter I haven't decided yet.
Sending the echo -e hello > /dev/ttyS4 I could see it on the oscilloscope.

EDIT
I successfully seen the output on my oscilloscope while booting. I just set the UART4 for the case. So I can't imaging what might be the default UART for debugging. Definitely not the UART2.
Code:
$sudo echo -e "hello baby" >/dev/ttyS2
echo: write error: Input/output error
Reply
#10
Hi Im4Tinker

UART2RX/PWM2 and UART2TX/PWN3 are multi-function GPIO, and the priority of PWM2/3 is higher than UART2.
so, set "intf:pwm2=off" and "intf:pwm3=off" at /boot/hw_intf.conf. UART2 should be work.

thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)