Electronic – UART signal distortion with AVR

avrserialuart

While evaluating the Libelium Waspmote board for wireless sensor networks, we discovered a strange communication problem.

We tried to set up a link between the waspmote and another board via UART at 115200 Baud using 8N1.

This is the resulting waveform on Tx for sending 9 times 0x55 (01010101b) :

Oscilloscope plot

The levels of high and low degnerate to the treshhold of detection: starting out with a High level of 3.3V, the peaks drop in to about 2.7V and the lows start out at about 1.1V and drop to 0.7V.

According to the target boards specification, the peaks should be > 2.3V and the lows < 1 V for correct operation.

It looks to me as if some capacitve behaviour emerges, but I have no clue why this happens.

I am in need of a clue on what is happening, what i am doing wrong, or what i can do to fix this problem.

Some additional info:

  • The microcontroller on the waspmote is an Atmega1281, and it's uart pins are directly connected to the communication link (no drivers in between).
  • I can not reduce the baudrate since the target board accepts 115200 baud only.

UPDATE 1

I made a detail shot of the signal. We are looking at a transmission at about 125kHz – which seems to be a bit far off the desired 115200 baud I'm aiming at.

Not quite 115200 baud

UPDATE 2

I measure identical waveforms when I disconnect the traget board and put the oscilloscopes probe directly at the microcontrollers UART-Pin. This seems to rule out problems with the target board.
However, the measured baudrate is exactly 125000, which is an error ofabout 8% from the desired target baudrate of 115200. Since the UARTs specification limits the baudrate skew to 2%, I guess there's my problem. However, since the waspmote board is locked to 8Mhz clock rate, the Atmega1281 on the board can not produce a more acurate 115200 baud clock through the prescaler registers ( I checked the manual). I guess I'll need another board to communicate with my target board.

Thanks, everybody.

Best Answer

Your problem is likely in using the wrong baudrate: 112500 is most likely a mistake, the standard rate in that range is 115200 (a search of the manufacturer's website for this number finds many hits, but none for 112500). You could also not be producing the programmed baud rate on one end or the other due to divider granularity; sometimes changing the oversampling of the UART can help. EDIT: Specifically, a value of 8 (divisor of 9) will get you 111111 baud from 8MHz if you set the "double speed" mode bit.

Secondarily, you have a problem such as lack of a common ground between the boards, or haven't grounded the scope to them, thus resulting in the distorted waveform. It's not clear yet if that is what the receiver sees, or if it's merely a measurement mistake in applying the scope.

Additionally, have you verified that the un-named external board also runs without a serial level translator? Most modular inter-board serial communications is at RS232 levels and logically inverted from the logic-level signals, though there are exceptions.