Can't enable UART2 using Adafruit_BBIO python library.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
mak352
 
Posts: 3
Joined: Sat Aug 27, 2011 7:36 pm

Can't enable UART2 using Adafruit_BBIO python library.

Post by mak352 »

Forgive me if this issue has already been answered, but I am trying to write data to UART1 and UART2 using Adafruit_BBIO python library and I'm having no luck. I'm a newbie at linux so I'm sure the problem is something that I am not doing correctly. I'm running on a BBB rev C with Debian Wheezy 7.4. After installing the Adafruit_BBIO library I wrote a python program to open the serial port and write some data to the port. Here is the setup portion of the program:

import Adafruit_BBIO.UART as UART
import serial

#Setup the serial port
UART.setup("UART2")
ser = serial.Serial(port = "/dev/tty02", baudrate=9600)
ser.close() # Make sure we start out closed

When it runs the ser = serial.Serial(port = "/dev/tty02", baudrate=9600) line, I get an error saying it can't find the /dev/tty02 file. My question is: how do I create the /dev/tty02 file? I appreciate any help on this issue.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Can't enable UART2 using Adafruit_BBIO python library.

Post by tdicola »

A lot has changed with the kernel and device tree overlays in the BeagleBone Black over the last year so there might be some quirks about only using the BBIO library to enable the serial ports. One thing to try is explicitly enabling the device tree overlay that supports the UART2 serial port. This is what the BBIO library tries to do inside of it with the setup function call, but since some of the overlays might have changed it could be running into issues.

Check out the post here for some great info on what to change. The basic idea is to connect to the BeagleBone Black's terminal and run a text editor like nano to edit the /boot/uboot/uEnv.txt file like this:

Code: Select all

nano /boot/uboot/uEnv.txt
Then add the following line at the bottom:

Code: Select all

capemgr.enable_partno=BB-UART2
Save (press ctrl-s) and quit (ctrl-x). Restart the BBB and login again to check if the /dev/ttyO2 path was created (can run a command like "ls /dev/tty*"). Give that a shot and let me know if you run into issues.

User avatar
mak352
 
Posts: 3
Joined: Sat Aug 27, 2011 7:36 pm

Re: Can't enable UART2 using Adafruit_BBIO python library.

Post by mak352 »

Thank you for your help. I actually tried what you recommended before, but I was still having problems. However, I was able to resolve this issue. It turns out that in my python code I was expecting the port path to be "/dev/tty 'zero' 2", but the path that was created was actually "/dev/tty 'letter O' 2" instead. As soon as I changed the zero to upper case letter O in the path, everything started working properly.

User avatar
tdicola
 
Posts: 1074
Joined: Thu Oct 17, 2013 9:11 pm

Re: Can't enable UART2 using Adafruit_BBIO python library.

Post by tdicola »

Oh good to hear it was an easy fix--yeah I make that kind of mistake all the time. :) Thanks for followup!

Locked
Please be positive and constructive with your questions and comments.

Return to “Beagle Bone & Adafruit Beagle Bone products”