Jump to content

UART GPIOs won't communicate to arduino

Recommended Posts

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???

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now