Using UART0 on Debian/Ubuntu


#1

Hi all,

I am posting for help on using the serial port on pins 5 and 7 on the low speed expansion header.

I am aware that the port is located in /dev/tty96B0 -> /dev/ttyMSM1 and have confirmed that the port is being seen by the db410c via an ‘ls -l’

I am trying to send some data to the db410c from a microcontroller via this uart port. I have confirmed that my issue is not on the microcontroller end both using a different single board computer running debian (beaglebone black), and the serial debug console on my microcontroller. I have also confirmed that the baudrates and parity settings on both ends are matching.

The microcontroller is triggered off of a serial event.

Here is a minimal example of what I am trying to do (I’m using python):

######################################################################
import serial
ser=serial.Serial(’/dev/ttyMSM1’, 115200) #Baudrate matches microcontroller
ser.flushInput()
ser.close()
ser.open()
ser.write(‘event’) # Trigger microcontroller
while(1):
while ser.inWaiting()==0: #Wait while theres nothing to read
pass
dataIn=ser.readline()
break
ser.close()
return dataIn
#################################################################
This hangs up during while waiting for there to be something to read. I have also confirmed that nothing is being written to the serial buffer on the microcontroller. This heads me to believe, having confirmed that my wiring is fine, that there is some sort of pin mapping/muxing issue with the UART that I am not resolving properly.

Are pins 5 and 7 on the LS connector NOT mapped to UART0 by default? I have also tried simply connecting RX to TX and have not even gotten the port to talk to itself, so I believe pin mapping/muxing to be the most likely issue here.

Available documentation on this sort of thing seems to be geared toward the Android developer crowd, and has not been very helpful to me. If anyone here has any insight into or experience with this issue I am describing please do let me know.

Thank you in advance.

-James


#2

Hi @James Shealy:

I used Python to talk to the Arduino micro-controller on the sensors mezzanine board in my Breakerball project https://developer.qualcomm.com/project/breakerball. The Python Source code is on github.

My code looks very similar to yours except I used ‘/dev/tty96B0’ which points to /dev/ttyMSM1. I’m not sure what the difference is, but maybe the permissions are different. I didn’t flush, close and open the port before using it, try commenting out those operations. I also didn’t bother to wait for input to become available, I just ran readline since it blocks waiting for input, more things to try commenting out.

Other things to check:

  • is your micro-controller expecting 1.8V signal levels on RxD and TxD? you may need a level shifter
  • did you try swapping RxD and TxD? the naming on these pins are confusing and inconsistent across devices.
    On the DragonBoard TxD is an output, and RxD is an input.

Let us know what you find.

Full Disclosure: I am employee of Qualcomm Canada, any opinions I may have expressed may not match the opinions of my employer.


#3

Thanks for the pointers. It turns out I had TxD and RxD swapped on the dragonboard. I’ve managed to get everything working now.