Jump to content


The UART3 is an unavailable in Ubuntu + OpenCV image

9 replies to this topic

#1 kns5498



  • Members
  • PipPip
  • 26 posts

Posted 12 May 2016 - 01:14 AM

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.

#2 youkee


    Advanced Member

  • Administrators
  • 237 posts

Posted 12 May 2016 - 02:30 PM

Please use ser.readline() to read the serial data from PC and put this section to loop.

Then try it again´╝ü

#3 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 03 October 2016 - 02:32 AM

I tried just a generic


screen /dev/ttyS1 115200


(from a known-working device that outputs data at 115200 bps)


and that doesn't work either.

#4 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 03 October 2016 - 02:36 AM

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

#5 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 04 October 2016 - 01:09 AM

I did find that if I plug my arduino in via USB, I can view the serial output via /dev/ACM0. However, that's not even remotely ideal for what I'm needing.

#6 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 17 October 2016 - 12:39 PM

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.o...t_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...

#7 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 17 October 2016 - 01:50 PM

Based on this:


and this:



It looks like the script.bin might not even be getting read anyhow? Which could explain why my video doesn't work either....

#8 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 18 October 2016 - 12:18 AM

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]

#9 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 23 October 2016 - 01:23 AM

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

#10 smily03


    Advanced Member

  • Members
  • PipPipPip
  • 55 posts

Posted 24 October 2016 - 02:24 AM

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.

Reply to this topic


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users