TinyCircuits Forum

General Category => General Discussion => Topic started by: nanawhite107 on June 30, 2017, 06:17:18 AM

Title: ATMega328p: Strange behaviour sending bytes through USART
Post by: nanawhite107 on June 30, 2017, 06:17:18 AM
I have an ATMega328p (MCU) connected to my computer via a USB to seal converter (BUB) from ModernDevice.com. The MCU is connected to the BUB by TX, RX and GND lines. Here is the datesheet of atmega328p (http://www.componentschip.com/details/Atmel/ATMEGA328P.html)

To send data using the U(S)ART, I use this library, written based on many solutions that can be found on the internet, and adapted to my needs:

UART.h:
So, after all this introduction, the problem is that when I connect to the MCU and send a byte, I only get some ASCII answer on my terminal when TEST 2 and TEST 4 are executed (method Echo, on COM.cpp). Every time I access a char array, or a string array, inside a loop, to send the array characters, I get trash in the desktop terminal.

Do you have a guess on what can be wrong?