Jump to content
Sign in to follow this  

The UART3 is an unavailable in Ubuntu + OpenCV image

Recommended Posts

i use the ubuntu + opencv image (pcduino8_ubuntu14.04_20160102_preinstalled_opencv2.4.11.img)


i have to a serial communication. but this image is not working.


how to work the UART3

echo 3 > /sys/devices/virtual/misc/gpio/mode/gpio0 
echo 3 > /sys/devices/virtual/misc/gpio/mode/gpio1

UART3-RX <----> RXD
UART3-TX <----> TXD

import serial
ser = serial.Serial("/dev/ttyS1", 9600)

#PC putty
pcduino 8 send to PC, it's OK.
but PC send to pcduino 8. It's a problem. why PC send data is return?
Sorry, I mistake.

Share this post

Link to post
Share on other sites

One thing that I noticed on the image too is that ttyS1 is a symlink for ttyS3:


root@whiteboard:/dev# ls -l ttyS*
crw------- 1 root tty     251, 0 Jan  1  1970 ttyS0
lrwxrwxrwx 1 root root        10 Jan  1  1970 ttyS1 -> /dev/ttyS3
crw-rw---- 1 root dialout 251, 3 Jan  1  1970 ttyS3



If you remove the symlink, there isn't anything to replace it; rebooting the board just re-creates the symlink.



root@linaro-alip:/home/linaro# dmesg | grep tty
[    0.000000] Kernel command line: console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p3 init=/init
[    0.000000] console [tty1] enabled
[    1.379595] uart0: ttyS0 at MMIO 0x1c28000 (irq = 32) is a SUNXI
[    1.570139] console [ttyS0] enabled
[    2.490914] uart3: ttyS3 at MMIO 0x1c28c00 (irq = 35) is a SUNXI
[   15.048790] init: tty1 main process (984) killed by TERM signal

Share this post

Link to post
Share on other sites

I don't know why I'm wasting so much time on this thing, I should just write it off as a stupid purchase, but since I'm being stubborn...


I don't know if this has much to do with anything; this is totally beyond my realm of normal hardware debugging, but with that said...


This is the uart configuration in pcduino8-uno-kernel-3.4.39-lichee/tools/pack/chips/sun8iw6p1/configs/pcduino8-linux/sys_config.fex :

;uart configuration
;uart_type ---  2 (2 wire), 4 (4 wire), 8 (8 wire, full function)
uart_used       = 1
uart_port       = 0
uart_type       = 2
uart_tx         = port:PB09<2><1><default><default>
uart_rx         = port:PB10<2><1><default><default>
uart_regulator  = "vcc-io"

uart_used       = 0
uart_port       = 1
uart_type       = 4
uart_tx         = port:PG06<2><1><default><default>
uart_rx         = port:PG07<2><1><default><default>
uart_rts        = port:PG08<2><1><default><default>
uart_cts        = port:PG09<2><1><default><default>
uart_regulator  = "vcc-io"

uart_used       = 0
uart_port       = 2
uart_type       = 4
uart_tx         = port:PB00<2><1><default><default>
uart_rx         = port:PB01<2><1><default><default>
uart_rts        = port:PB02<2><1><default><default>
uart_cts        = port:PB03<2><1><default><default>
uart_regulator  = "vcc-io"

uart_used       = 1
uart_port       = 3
uart_type       = 4
uart_tx         = port:PG10<3><1><default><default>
uart_rx         = port:PG11<3><1><default><default>
uart_rts        = port:PG12<3><1><default><default>
uart_cts        = port:PG13<3><1><default><default>
uart_regulator  = "vcc-io"

uart_used       = 0
uart_type       = 4
uart_tx         = port:PE10<3><1><default><default>
uart_rx         = port:PE11<3><1><default><default>
uart_rts        = port:PE12<3><1><default><default>
uart_cts        = port:PE13<3><1><default><default>
uart_regulator  = "vcc-io"

Only UART0 and UART3 seem to be used. When I look at the pinout from the schematic, UART0 is supposed to be the debug, and UART3  is "UART3-TX" and "UART3-RX." This is labelled as pins 0 and 1 on the board. So it looks like it should be enabled in the hardware at least maybe?


Details on the uart fex configuration: http://linux-sunxi.org/Fex_Guide#uart_configuration


It looks like the config is saved in script.bin in the mmcblk0p2 partition on the SD card; you can use bin2fex to convert it back into a fex file to see how it's configured there just to make sure that it's the same there as what's in the kernel config on the github site





(I also had to install the package pkg-config.)


Having some problems decompiling the bin back to a fex though :/

root@whiteboard:/home/linaro# sunxi-tools-master/sunxi-fexc -I bin -O fex script.bin script.fex
E: fexc-bin: Malformed data: version 55752.1.2.
root@whiteboard:/home/linaro# sunxi-tools-master/bin2fex script.bin script.fex
E: fexc-bin: Malformed data: version 55752.1.2.

I don't have time to dig into this right now, but will hopefully soon.


I really really wish someone from linksprite would be active on the forums...

Share this post

Link to post
Share on other sites

Ok, so I tried building a new script.bin off of that sys_config.fex file I'd referenced earlier, but no change on the serial datalogging working:

root@whiteboard:/home/linaro# sunxi-tools-master/fex2bin sys_config.fex newscript.bin
root@whiteboard:/home/linaro# mkdir /mnt/p2/
root@whiteboard:/home/linaro# mount /dev/mmcblk0p2 /mnt/p2/
root@whiteboard:/home/linaro# cd /mnt/p2/
root@whiteboard:/mnt/p2# ls
bootlogo.bmp script.bin uEnv.txt uImage
root@whiteboard:/mnt/p2# mv script.bin script_old.bin
root@whiteboard:/mnt/p2# mv /home/linaro/newscript.bin ./script.bin
root@whiteboard:/mnt/p2# chmod 777 script.bin
root@whiteboard:/mnt/p2# reboot
root@whiteboard:/home/linaro# echo 3 > /sys/devices/virtual/misc/gpio/mode/gpio0
root@whiteboard:/home/linaro# echo 3 > /sys/devices/virtual/misc/gpio/mode/gpio1
root@whiteboard:/home/linaro# screen /dev/ttyS1 115200
<<<10 minutes without displaying anything, while the other serial datalogger listening on the same line reported stuff fine>>>
[screen is terminating]

Share this post

Link to post
Share on other sites

Yay, I figured it out! And it was such a stupid, stupid thing :/


I was thinking as I was driving to the hospital a few days ago...the tutorials that I saw just referenced connecting the TX and RX pins on the UART (pin 0 and 1.) But they didn't mention connecting the ground. So there wasn't a return path for the signal to get back to the Arduino. I just had to set it up so that there was a common DC ground between the two boards, and voila :)


Still no video at all, but at least the serial connection is functional now :D

Share this post

Link to post
Share on other sites

Ok, I finally got video working. I ended up having to do a different display (the output is apparently hard-coded for 720p at 50hz??,) different microsd cable, and found that I couldn't have the display or keyboard hooked up during first boot -- the board would hang indefinitely. But now I'm able to at least view the desktop on a TV.


Going to try to dig through some things to figure out how to fix the display resolution hopefully.

Share this post

Link to post
Share on other sites
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this