UART0 Android Sensors Mezzanine

Testing the Sensors board to use it in an Android OS.
UART1 is fine and act as the console. (Mentioned in another forum thread)

Send the data from the DragonBoard to the Arduino in the Sensors Board, UART0 is fine.
But if I try to open the UART0 (/dev/ttyHS0) in receive mode I set the RTS which reset my Arduino!
I know this is used to program the Arduino directly from the DragonBoard in Debian but what can we do if we just want to comunicate with the Arduino and not program the Arduino?

I set the parameters ($ stty -F /dev/tty96B0 -hupcl # Release ATMEGA from reset) as mentioned in the Debian example and this in fact release RTS but when I open the port with an Android App it RTS is back.

Any idea on how to remove this reset? If not possible could we place a jumper in a new Sensors board redesign to open this RTS connection?

NOTE: I also tested the output of the Arduino and my data are coming out OK in another external FTDI port.

BTW: to be able to use “stty” in Android I installed Busybox and this is fine.

Sorry I made a typo, the stty command is as follow: $ stty -F /dev/ttyHS0 -hupcl

So I wrote the following test program (which continually shouts out on the UART so I can see whether the board is running):

unsigned long alarm;
const unsigned long interval = 2000;

void setup() {
	Serial.begin(9600);
	alarm = millis() + interval;
	Serial.println("Completed setup() OK\n");
}

void loop() {
	while (Serial.available() > 0) {
		int byte = Serial.read();
		Serial.print("Received from UART: ");
		Serial.println(byte, DEC);
	}

	if ((int) (millis() - alarm) > 0) {
		alarm += interval;
		Serial.print("Alarm fired at ");
		Serial.println(millis(), DEC);
	}
}

For me, on my DB410c, this “just worked”. That said, I was disappointed at how hard it was to get the existing Arduino example sketches to run. I’m afraid I didn’t use the IDE, I just following the instructions to use the arduino tools from the command line (part of the sensors board manual):

ln -s /usr/share/arduino/Arduino.mk Makefile
make
make upload
sudo picocom -b 9600 /dev/tty96B0

There are some problems with resets though (when picocom connects the AVR is reset).

Sorry, reading back the above it looks very unclear.

The picocom connection sequence resets the AVR but it also releases it allowing me to interact with the serial port.

Mh!! Thank you so much Daniel for following up but we need some sync. I am not sure to undersatnd what you have done.
First of all, I am using Android and do not know what Picocom is.
I made a program in Arduino which continue sending data out, which works if I connect whatever FTDI USB driver. I can see my data going out in my PC terminal.
But I cannot receive these data to my DragonBoard because as soon as I try to fetch the data and set my UART0 in the DragonBoard in receive mode the RTS is raised and reset my Arduino… Then the Arduino stop to send data obviously…

That is the problem that I am facing.

Basically what I am trying to do is to have a Arduino able to communicate freely with the DragonBoard back and forth and not programming my Arduino with the DragonBoard.
Building an app in DragonBoard/Android I should be able to have the Arduino collecting data and sending them to the DragonBoard.
I program my Arduino thru the P6 connector with the Arduino ISP programmer which is working great. I do not need the DragonBoard to programm my Arduino.

Follow UP
OK I found the simplest way to get rid of this problem. I removed the resistor R5 (620 ohm) to open the RTS signal and I can communicate with the DragonBoard.
In such way RTS does not reset the Arduino anymore.
Another problem shows up, the data are plenty of garbage other than the message itself. I have no clue about this new problem.
I checked the signal hi and low level on the level shifter and it seems correct.

Sorry. I guess I wasn’t connecting the dots very well in my last post. Basically the experiment in Debian shows that the DB410c hardware is fully capable of establishing a serial connection without reseting the sensor board (picocom is simply a small tool to point a terminal emulator at the serial port). It is rather difficult to bridge the gap though. The Android kernel for DB410c uses a different serial port driver and its non-trivial to run the same programs (having a debian chroot might be a good thing to have on an sdcard since that makes it easy to install the same userspace programs).

Anyhow I’m glad to hear that removing the resistor allows progress without having to study the software differences.

For the corruption, what baud rate are you running and is the data to or from the AVR causing the problem?

Jean-marc: Amplifying Daniel: Please describe in detail:

  1. What situation works properly: What software do you have sending and receiving on each side that does work properly?

  2. What situation results in junk data being received on which side? What rate of data appears, and what does it look like?

  3. How did you inspect the level shifter voltages.

  4. What additional wiring, if any, do you have connected to the RX and TX lines on the Sensors board?

Thanks

OK thanks guys for your help to progress on this. Very constructive.
To answer @Daniel: Yes I bet the USART0 works well with Debian. But not with a normal use in Android. At least in my humble understanding.

To answer @Gwideman

  1. I have no problem receiving to Arduino if sending data from DragonBoard so now I concentrate in OUT from Arduino in IN to DragonBoard. The software is a small loop in Arduino sending “Hello\n\r” and looping every seconds.

  2. Placing (DragonBoard side) the ttyHS0 in “cat -v < /dev/ttyHS0” (meaning input mode) I receive any kind of string of characters + my Hello, (which is often truncated) ello or Hel or whatever preceding or following by non ASCII characters. The reception is also sporadic and do not follow the one second loop.
    To do this I simply use ADB or also the Console in UART1.
    I also wrote an app in java to receive data from the ttyHS0 and receive the same string of data. (garbage + my data)

  3. I use my oscilloscope and can see the data on both side 1.8 and 5V just fine. Signal 96UART0_RX and PD1_TX.

  4. If I wire my Arduino Output into a FTDI serial->USB directly to the Arduino output (which is parallel to the DragonBoard) into my PC I get all my data, I mean just “Hello”. Of course I wire only the RX into the FTDI.

I think we may search and understand how is the UART0 initialized by Android and if we do not have a conflict with the GPIO (GPIO_1 BLSP) and UART0 on that pin connection. That is my position now unless someone has more idea or knowledge.

Thank you again, I will try to participate at the next 96 Open Hours but not sure for this time.

Follow up:
Mezzanine is out of question I remove it and made my own level shifter and communicates with a PC and a FTDI driver.
I can send data to my pc from the Dragonboard but cannot receive the data correctly in my Dragonboard.
Still receiving control characters and my string of data together…

Hi jean-marc

sorry to late response - is this thread answering your question in Android?

http://www.96boards.org/forums/topic/dragon-board-410c-uart/#gsc.tab=0

HTH
Yang

Hello Yang, thank you so much for helping, even late I appreciate.
Unfortunately I went thru this thread some time ago, which gave me some hints but without finding any help beside they sayed that the UART0 was on ttyHS4 and not ttyHS0 and was working.
Now, on my version, it is on ttyHS0 and working only on TX but not on RX. There is no ttyHS4.
In the following days I will try to load another Android version just to see.

Like anyone not having too much time to “play with” :smiley:
Thanks again!

FollowUP on UART0 and ANDROIS OS.
On Nov 2016, I loaded the Android version image 99, (read on the forum that the image 118 does not boot :-()

The change is that the UART0 is now ttyHS4 and no more ttyHS0 as my previous version… non sense to me :frowning:
Anyway change my programming to adapt the new name, but same result as described above.

Looking at the schematics and if I understand correctly UART1 is the console and also the debug channel, so according to me UART0 should be free to use.

Since the sensors mezzanine has an AVR (Arduino) to handle sensors or GPIOs, how someone planned to send any Arduino result back to the DragonBoard?
The best easy way would be to use the serial port, what do you think?

Anyone could help on this topic?
Anyone knows if the UART0 is available to use ON ANDROID OS (not Debian)

Has the issue been resolved in the meantime? We’d also like to communicate with the db410c via UART on Android.

@swalter
Unfortunately I did not receive any news since a while.
I am expecting for the new version in October to have some fixes on the UART0 port.
I will also try to recall Qualcom for more followup.
Will get back to you as soon as I have more.

Good to hear there are others who have the same problem ;). It’s a pity that something as basic as UART doesn’t work.

We switched to the hikey board. UART RX/TX works on the Hikey board, but cutting edge AOSP master branch has other issues that the DB410c has not (COSU not working, overheating, USB connection sporadically not available after reboot, …).

Have you settled on an alternative to the db410c?

Hello @swalter, for Android no I stick with db410c and hope for a corrected AOSP :smiley:

Hi,
I can understand, It is late but I am facing same problem. It is sending garbage while sending my data. Sometimes, I get correct data but sometimes I do not. I had tried with two DB410C Rx and Tx both worked but from Arduino it is not working. Did you get any solution?