Jump to content


UART GPIOs won't communicate to arduino

  • Please log in to reply
3 replies to this topic

#1 hipsi



  • Members
  • Pip
  • 7 posts

Posted 27 July 2016 - 02:26 AM

I have a V3 nano and trying to use the uart pins to send serial to my Arduino nano RX pin, but to no avail.  I have it working with USB connection but I'd prefer using the pins as it will all be PCB mounted.  I tried a loopback test on the uarts (linking the tx to rx) on the PCduino and this works fine.  

My initial attempt was to connect the tx pin on the PCduino directly to my Arduino nano RX, (since it'll be 3.3v into my Arduino, shouldn't be a problem).  I didn't get any response on the Arduino at all when sending from the PCduino serial monitor in the IDE.  I then tried connecting the rx pin to the tx on my Arduino through the Linksprite voltage converter shield.  Still doesn't work .  Truth is I don't need to send anything from the Arduino to the PCduino anyway.  

I can confirm if I send serial through the serial monitor using USB the Arduino does receive it.


any ideas???

#2 youkee


    Advanced Member

  • Administrators
  • 237 posts

Posted 27 July 2016 - 06:07 AM

Please check the following things:

1. baudrate

2. try to swap the tx and rx pin when connect Arduino and pcDuino via UART.

#3 hipsi



  • Members
  • Pip
  • 7 posts

Posted 28 July 2016 - 07:08 AM

I've confirmed baudrate and tried swapping the pins.  When I ls - /dev/ttys1 I get 

crwxrwxrwx 1 linaro linaro 3, 49 Jan  1  2010 /dev/ttys1

but when I run my python code (which works for ttyUSB0) but changed for ttys1 I get

SerialException: could not open port /dev/ttys1: [Errno 5] Input/output error: '/dev/ttys1'

my python code is

#!/usr/bin/env python

import serial
import cgitb
import cgi


## Select and configure the port
myPort = serial.Serial('/dev/ttys1', 9600, timeout = 10)

form = cgi.FieldStorage()
serialData = form.getvalue('input')

print "Status: 200 OK", "\n\n";

## Write the value retrieved from the POST form to the serial port
## Declare serialReturn as the variable to read a 3 byte packet from serial port
serialReturn = myPort.read(3)
## Check if the serial port returns clr or CLR
if (serialReturn) == "clr" or (serialReturn) == "CLR":
## Send line to the HTML file
print "The display is currently clear"
## else send this line including the value read from serial.
else: print "The current displayed wait time is",(serialReturn),"minutes"
## close the serial port so it can be used by other stuff.

#4 hipsi



  • Members
  • Pip
  • 7 posts

Posted 08 August 2016 - 11:58 AM

I got to the bottom of my issue. Simple fix really. My arduino and pcDuino didn't have a common ground. When i added that it worked fine (using a logic level converter).


For extra points, I also found that although my Python script would run fine with no errors, I couldn't get any serial output from it until I ran a serial sketch from the IDE.  Another silly NOOB mistake, I had neglected to add

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

to my /etc/rc.local file so it the Python script would work on bootup without intervention.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users