Opening serial port causes kernal panic


Recommended Posts

I'm running Armbian_5.20_Micro_Debian_jessie_3.4.112 on an Olimex A20 micro board.

I find that opening serial port device `/dev/ttyS2` causes the system to crash. The board heartbeat LED either stops or blinks rapidly. The board itself is not pingable.

I can reproduce this issue with a simple from the shell using: 

cat /dev/ttyS2

 or from c code using:

fd = open("/dev/ttyS2", O_RDWR | O_NOCTTY | O_NDELAY);

`/dev/ttyS2` is linked to UART6. In the fex file, I have configured it like so:

[uart_para6]
uart_used = 1
uart_port = 6
uart_type = 2
uart_tx = port:PI12<3><default><default><default>
uart_rx = port:PI13<3><default><default><default>

Note that the UART6 is on MUX3 as it should be according to sunxi's pio documentation for A20.

 

Any ideas?

 

Link to post
Share on other sites
Armbian is a community driven open source project. Do you like to contribute your code?

Why do you think so? If I remember correctly uart_port = 6 should configure /dev/ttyS6, but you can check the source code if you want to confirm port numbering scheme

 

I'm not sure why, but this is the behaviour I'm currently seeing.  :blink:

It may have to do with the fact that I've set uart_used = 0 for all UARTs but 0,3,6 & 7. So, although I do get ttyS0 -> ttyS7, UARTs 0,3,6 & 7 are configured as ttyS0 to ttyS3 & I can't access >ttyS3.

$ cat /dev/ttyS7
cat: /dev/ttyS7: Input/output error
Link to post
Share on other sites

Thanks for pointing me in the right direction @zador.blood.stained.
Here are the crash logs from serial console: 

root@micro:~# cat /dev/ttyS2
<4>i2c-0, xfer timeout

[   63.123577] i2c-0, xfer timeout
<3>axp_mfd 0-0034: failed reading at 0x23

[   63.130520] axp_mfd 0-0034: failed reading at 0x23
<3>[cpu_freq] ERR:try to set voltage failed!

[   63.139404] [cpu_freq] ERR:try to set voltage failed!

And here's the dmesg output for registered uarts:

root@micro:~# dmesg | grep uart
[    0.996902] [uart]: used uart info.: 0xc9
[    1.001620] [uart]: serial probe 0 irq 33 mapbase 0x01c28000
[    1.027944] sunxi-uart.0: ttyS0 at MMIO 0x1c28000 (irq = 33) is a U6_16550A
[    1.889704] [uart]: serial probe 3 irq 36 mapbase 0x01c28c00
[    1.921599] sunxi-uart.3: ttyS1 at MMIO 0x1c28c00 (irq = 36) is a U6_16550A
[    1.933439] [uart]: serial probe 6 irq 51 mapbase 0x01c29800
[    1.965318] sunxi-uart.6: ttyS2 at MMIO 0x1c29800 (irq = 51) is a U6_16550A
[    1.977174] [uart]: serial probe 7 irq 52 mapbase 0x01c29c00
[    2.009053] sunxi-uart.7: ttyS3 at MMIO 0x1c29c00 (irq = 52) is a U6_16550A

Have you seen something like this before?

Link to post
Share on other sites
I was able to solve the problem. It was related to UART settings in the Fex file.

Somehow, I hadn't set the pull-up on UART6 & UART7. ->



[uart_para6]
uart_used = 1
uart_port = 6
uart_type = 2
uart_tx = port:PI12<3><default><default><default>
uart_rx = port:PI13<3><default><default><default>
#                          ^
#                          |
#                         Here


It should've been ->



[uart_para6]
uart_used = 1
uart_port = 6
uart_type = 2
uart_tx = port:PI12<3><1><default><default>
uart_rx = port:PI13<3><1><default><default>


I guess I will be moving to the mainline kernel in the future.

Link to post
Share on other sites
Guest
This topic is now closed to further replies.