Community
cancel
Showing results for 
Search instead for 
Did you mean: 
PBene
Beginner
1,183 Views

Spurious characters: TTL over UART1 (C/C++)

Jump to solution

Hi

I'm using mraa for 2-wire serial communication over UART1 on the Intel Edison (breakout pins J19-8 and J18-13) with a LinkSprite JPEG Color Camera. (/message/313323# 313323 https://communities.intel.com/message/313323# 313323)

I have a 1.8V <=> 5V level shifter between the Edison and the device.

Everything is working fine. I can send instructions to the device and I get the expected comprehensible replies from the device. Except that every reply I receive is postfixed with a certain (variable) amount of garbage.

E.g. I'll send a command, do a mraa_uart_read(..) and get:

0xff 0xff 0xfd 0xff ..... 0xff 0xff [valid response]

Because the response is in fact valid, the communication parameters (baud rate, data bits, stop bits, parity, flow control...) must be set up correctly. I just need to get rid of the garbage preceding the responses. At the moment I'm just skipping over it until I come to the valid stuff, but that is, of course, a dreadful solution.

(I was wondering if the Edison does not have something else connected to UART1 which I don't know about, or if there are some default control mechanisms for UART1 which I must disable. I'm pretty clueless with Linux).

ANY ideas, please?

0 Kudos
1 Solution
FerryT
Valued Contributor I
92 Views

It's a bug. I'm not if it was caused by mraa, the kernel/u-boot or a combination of both.

- if it is just the kernel, try a cold start (unplug the power cord)

- if it still persists, it might be mraa, what version to you use?

- we worked around this by re-configuring the serial port here https://github.com/htot/hs_uart/blob/master/hs_serial.c hs_uart/hs_serial.c at master · htot/hs_uart · GitHub

- I haven't seen this issue with our unofficial image https://github.com/htot/meta-intel-edison GitHub - htot/meta-intel-edison: Here is the meta-intel-edison that builds, tries to stay up to date and provides a PREE… , but that is based on Morty, U-Boot 17.03, Linux 4.12 and mraa 1.7, basically everything is updated, so don't no where this was fixed.

View solution in original post

3 Replies
FerryT
Valued Contributor I
93 Views

It's a bug. I'm not if it was caused by mraa, the kernel/u-boot or a combination of both.

- if it is just the kernel, try a cold start (unplug the power cord)

- if it still persists, it might be mraa, what version to you use?

- we worked around this by re-configuring the serial port here https://github.com/htot/hs_uart/blob/master/hs_serial.c hs_uart/hs_serial.c at master · htot/hs_uart · GitHub

- I haven't seen this issue with our unofficial image https://github.com/htot/meta-intel-edison GitHub - htot/meta-intel-edison: Here is the meta-intel-edison that builds, tries to stay up to date and provides a PREE… , but that is based on Morty, U-Boot 17.03, Linux 4.12 and mraa 1.7, basically everything is updated, so don't no where this was fixed.

View solution in original post

ABols
New Contributor I
92 Views

Hi Thomas!

Welcome to the "Multiple-0xFF-garbage club"! I thought I was the only one in the world unfortunate enough to stumble upon this bug, but now there's two of us

I've been tackling this problem for a few months now. So far, no one could help me get rid of it...

I've already tried what Ferry suggested and it didn't help, same outcome.

I've also got another problem which I think is similar to this one:

I suspect that the problem lies within the mraa and upm libraries. I was planning on trying out drivers from other libraries like Arduino but I haven't got the chance to yet.

If you'd like, try it out yourself and please share your results.

PBene
Beginner
92 Views

Right, OP here. For whomsoever might be interested:

My problem was with the reference voltage I supplied to measure Tx/Rx against.

My setup was TTL camera <=> level shifter <=> Edison.

The spec for the TTL camera said that either a 3.3V or a 5V power supply will be suitable.

The demo I used as a guide ( /message/313323# 313323 https://communities.intel.com/message/313323# 313323) had a similar setup, but the TTL camera was powered from the 3.3V power out pin on the Edison. I did not want to do that, because I believed that it will draw too much current through the Edison. I therefore powered the camera separately from a 5V power supply. I also supplied the 5V as a reference voltage to the level shifter from the same power supply, assuming that the Tx/Rx signals will flip between 0V and Vcc = 5V. It turn out that the camera output on Tx/Rx varies between 0V and 3.3V instead of between 0V and 5V - therefore the 5V reference to the level shifter resulted in too low a voltage switched through the level shifter for a positive voltage.

I changed the 5V reference voltage to the level shifter on the camera side from the 5V Vcc to the 3.3V from the Edison power out, and the problem disappeared.

Hurray!!!

Reply