Arduino Programming with GPIO Serial

Moderators: mdrjr, odroid

Arduino Programming with GPIO Serial

Unread postby maddog2201 » Tue Jun 13, 2017 8:48 pm

For the longest time I've been trying to find out how to program the arduino directly using the serial interfact in GPIO, I spent a lot of time trying to find how to do it and ended up stumbling on a tutorial showing how to set it up for the Raspberry pi. Simply changing the values of the GPIO serial to match the odroid worked a charm in lubuntu 14.04. I did a lot of steps that I'm beginning to think I didn't need to, for example installing command line tools. I think I only needed to these steps, if you have any issues I'll link the documentation that I followed to get it working so you can follow that if need be.

First thing to do is to check if the serial port is being used by the kernal, to do this you want to enter in the terminal
Code: Select all
fgrep -rn ttySAC0 /etc /boot

If it's anything like mine nothing will be using it, there'll be two files that are Symbollically linking ttySAC0 to ttyACM99 but nothing else, that's fine.

Next you'll need to edit /etc/sysctl.conf file. Add to the bottom:
Code: Select all
kernel.sysrq-0

This is to stop the kernel from calling the port and causing it to hang on boot, I've actually got no idea if it actually does anything on the odroid but I put it in there and it works so it must be doing something. (Can you tell I'm an amateur?)

Next step, you'll need to set a few environment variables so that the odroid knows where the arduino is hooked up. Add the below to your .bashrc or .profile file found in your home folder. They are hidden.

Code: Select all
export BOARD=uno

export SERIALDEV=/dev/ttySAC0

export ARDUINO_PORT=/dev/ttySAC0

export ARDUINO_DIR=/usr/share/arduino


Now, the most important step is the hookup, you'll need to run all the connections through a logic level converter as the ARDUINO uses 5V whereas the ODROID uses 1.8, if you put 1.8 into the ODROID you will damage it, so best to just get a logic level converter. You'll need 3 Data pins, RX, TX, and GPIO #204. Through the logic level converter, connect RX on the odroid to TX on the Arduino, TX on the odroid to RX on the arduino, and GPIO #204 through the logic level converter to the reset pin on your Arduino. I don't know if it calls for this or I just got lucky, but it seems to reset correctly as it needs to in order to upload new sketches, it works so I'm going to assume I accidentally set it up correctly.

Now that you've done that it should all work, open the Arduino IDE, make sure the arduino selected is an UNO and that the Serial Port is ttyACM99 and it should be good to go. Upload blink example and hook an LED up to pin 13 to ground and it should start blinking.

http://www.deanmao.com/2012/08/06/ardui ... pberry-pi/

Original article. Thanks to Deanmao for the good Tutorial.

Enjoy, I hope this was clear and works for everyone.
"Some days it don't pay to get out of bed"
~Floghorn Leghorn.
User avatar
maddog2201
 
Posts: 48
Joined: Tue Jan 21, 2014 9:44 pm
languages_spoken: english
ODROIDs: U3

Re: Arduino Programming with GPIO Serial

Unread postby odroid » Wed Jun 14, 2017 4:00 pm

Thank you for the useful tip.

Actually, the ttyACM99 was created to work with our IO Shield board.
http://www.hardkernel.com/main/products ... &tab_idx=2
User avatar
odroid
Site Admin
 
Posts: 23684
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID

Re: Arduino Programming with GPIO Serial

Unread postby maddog2201 » Wed Jun 14, 2017 11:25 pm

that makes more sense. I've since discovered that this only works out of the box like this with Arduino IDE 1.0.5, I'm in the process of trying to remedy it for 1.5.3, it no longer triggers reset, so I'm trying to get pin 204 to do it, but I can't work out how to call the GPIO in python. ones I get that sorted I'll update this thread
"Some days it don't pay to get out of bed"
~Floghorn Leghorn.
User avatar
maddog2201
 
Posts: 48
Joined: Tue Jan 21, 2014 9:44 pm
languages_spoken: english
ODROIDs: U3


Return to Hardware and peripherals

Who is online

Users browsing this forum: No registered users and 1 guest