Setting up arduino with HTerm - data display problems - arduino

I am trying to configure my Arduino Wi-Fi module (RN-XV) with HTerm. However, when i connect it, it starts giving me strange output to the Recieved Data box. Squares and some characters, but nothing that i could read or use. What might be the problem?
(Problem shouldnt be anything about the values i set before connecting, because those settings worked with other guy)
Thanks!

Sounds like the com port speed is set wrong
According to the manual Manual
9600 baudrate, 8 bits, No Parity, 1 stop bit, and hardware flow control disabled is the default setup.
If this does not work try different com speeds.

Related

Arduino Uno serial monitor printing garbage

I am using an Arduino Uno and GSM sim800l for a project. It looks like something is wrong and I don't know what it is. Here is my code:
#include <AltSoftSerial.h>
AltSoftSerial altSerial;
void setup() {
Serial.begin(19200);
Serial.println("AltSoftSerial Test Begin");
altSerial.begin(19200);
altSerial.println("Hello World");
}
void loop() {
char c;
altSerial.print("altSerial is working.");
if (Serial.available()) {
c = Serial.read();
altSerial.print(c);
}
if (altSerial.available()) {
c = altSerial.read();
Serial.print(c);
}
}
Its output was like this:
AltSoftSerial Test Begin (linebreak)
Hello World (linebreak)
ltSerial is ok⸮⸮M⸮ɥ⸮⸮⸮is okalt //insert long random garbage here
I tried changing the baud rate of the code and serial monitor to keep it matched, but it is not working. I tried to lower it as low as 300 and tried up to 19,200 baud as well.
I also tried menu Tools → Fix encoding and reload, but it still didn't solve the problem. It is my first time using this type of hardware, so please bear with me. My goal is to use it to send SMS messages. but right now I'm trying a smaller task with it to try and understand it better.
The Arduino IDE version I am using is 1.8.7.
It is a troubleshooting tree:
I am going to assume the system is Windows 10, but the basic ideas are the same if the way to achieve them are different.
Plug in your Arduino. You already said your serial monitor is set to 19200, but be sure you are sure, because that is very often the problem.
if you are sure of #1, open Control Panel → Device manager → Ports
If you don't see "Ports" in the list, then your computer isn't seeing the Arduino. This could be anything from a bad Arduino to a bad cable to a bad USB port on your PC. Try switching all those out one at a time to see if you can get anything talking to the COM port at speed. Since you were getting something in the serial monitor, this won't be your particular problem.
Click on "Ports" to expand it, and verify you see the Arduino listed. Right click on the Arduino, disable, and enable it again. See if that fixes the baud rate problem.
Look at Arduino properties
Does it say your device is working properly? If no, look at events and you will see an error description. Fix whatever it says is wrong. If yes, continue.
Port settings will likely be 9200, 8, None, 1, None. Even if your baud rate in the serial monitor window is 19200, you will still probably see 9200 in Device Manager, don't worry about it. It feels wrong, but it is normal. Microsoft seems to like keeping 9600 here, even if the last thing I did with this port was different. The data bits, and other settings listed above are a different matter.
next, click on Advanced
is your Arduino-assigned port number showing up? Does it say 'In Use' beside it? If it does, this is your problem. I know. Strange, huh? Trust me, if it says 'In Use', that means that something internal to Microsoft is using the port, but it isn't your Arduino. Power shell can help you resolve what has it, but that's another story, but the best bet now is reinstall your driver.
Click the Driver tab, and verify your Driver Provider is Arduino LLC. I've never seen it not that, but if it isn't, I would try to find out why.
Go ahead and Update the driver and reboot your computer, even if you aren't prompted to reboot, do it anyway.
Didn't fix it? In the Driver tab, Disable the device, and re-enable it. That might fix the problem, too.
Didn't it fix it? Don't uninstall the driver just yet.
Click Details. Do you see Arduino?
Look at the Events tab. If you see an error, then fix it.
Still not working? Uninstall your serial driver, and reinstall it.
Still no 19200? If you have garbage, the timing on your RX pin is not synchronized with the Arduino TX pin. You now need a logic analyzer, and that is more than can be covered here.

SIM800C not registering on network

I'm desperately trying to set up the SIM800C controller, but to no avail.
It seems I cannot register on any network. The AT+COPS=? comaand returns:
AT+COPS:",(0-4),(0-2)
I'm trying to figure out what the " means in that return as it's not defined in the documentation?
For those with more experience with this device: Is there anything obvious I may have missed during startup? I have set the baud rate and currently I'm simply powering up the device and setting different frequency bands to test. I worry that there may be some other commands required to get the device in a normal operating mode.
I unfortunately don't have time to work through all the documentation so I thought I would try some experienced folk out there. Any help would be appreciated!
I unscrewed the antenna and noticed that both the antenna connector as well as the connector it screws into on the PCB was female. The antenna therefore didn't make contact.
I found a pin, forced a gender swap and the Sim800 registered on the network!

Raspberry Pi and Arduino Mega 2560 UART behaviour difference

I've been trying to establish serial (UART) communication between a Raspberry Pi Model B Revision 2.0 (checked the model like described on this page) and Arduino Mega 2560. I made a service on the Pi that writes to UART and then expects a message and a coworker programmed the Arduino with an echo program. While they were communicating, I had trouble receiving data, meaning that it was clustered in 8 byte pieces and I had to introduce a timeout for waiting between them (I was actually as much as available and calling select()for the next cluster but it turned to be 8bytes a cluster, except for maybe the last one. As explained in a question I found on this site, the programmer is the one to take care of the protocol and can not rely that the whole message will be ready to read at once (that is logical).
However, when I just connected Pi's TXD and RXD pins, no matter how much bytes I tried sending, it sends them in one go (I've gone up to a bit more than 256, that's more than enough for my purposes). I also have around 50 milliseconds of duration difference, measured directly from within the program, using gettimeofday() function.
So, could anybody clear things for me:
Why is this happening?
Is this difference in behaviour expected?
Is there a potential problem in either of the devices (if that can even be concluded from the given information).
Of course, any additional information is welcome, in case I forgot asking something that is deemed important.
Why is this happening?
I tried some time back communicating Arduino-Arduino and Arduino-Pi. I faced some problems with UART communication. However, you might want to keep same Baud rate on both the devices. With Pi, you might need to trigger an event if you receive data from Arduino. On the other side, if you code runs longer, then you might lose some data i.e. your Arduino code is running something else while Pi sends data over UART.
Is this difference in behaviour expected?
Yes. Arduino is a microcontroller based device while Pi is microprocessor based (runs on OS)
Is there a potential problem in either of the devices (if that can even be concluded from the given information).
I don't think there could be any hardware problem unless it is not functioning at all.
Also, because of this issues, I switched from UART communication to SPI communication. This solved my problem completely.

Understanding serial device settings

Please feel free to slap me and send a link if this question has already been answered; I just couldn't find it. I did search though.
I've been trouble-shooting communication with a serial device. In looking over lots of documentation, I now understand what the settings for "baud rate," "data bits," "stop bit," and "parity" mean. But what I can't seem to understand is who (sender or receiver) determines these settings.
Say I have a serial device plugged into my computer. In my code, I open a connection to the serial port and specify something like 9600,8,E,1. When I specify these settings, do these get sent to the sending itself, so that it knows how to send the data to my receiver? Or is it more common for a sender to expect a receiver to comply with strict settings?
The issue I'm having is that I attempted to use "Even" parity, and that resulted in tons of irregular transfer errors. When I use "Odd" parity, however, those errors go away. There is also a USB to Serial adapter involved in my set up. There aren't any transfer errors with Even or Odd parity without the adapter in the middle. So I'm just having a hard time understanding whether the device itself doesn't support sending with Even parity, or whether the adapter is the thing causing trouble, etc.
Thanks.
When I specify these settings, do these get sent to the sending itself, so that it knows how to send the data to my receiver?
No.
To expand on the comment by Hans Passant, both sides of the serial port have to agree on the settings, otherwise they won't talk to each other. If they don't agree, you will get gibberish data on either side as the hardware will read the data at an incorrect time. The settings are normally documented in the manual for the device that you are attempting to communicate with. For example, to communicate with a Cisco router, you will generally use the following settings:
Bits per sec : 9600
Data bits : 8
Parity : none
Stop bits : 1
Flow control : none
When you setup the serial port on your side, you must use these same settings, there is no hardware-level handshake between the two devices that determines the speed that they will communicate at.
Sometimes, the format for the serial port settings may be given in a format like the following:
9600,8,N,1
Which is just shorthand for the above quote(9600 baud, 8 data bits, no parity, 1 stop bit)
In my experience, most devices default to 9600,8,N,1, the next common serial setting is 115200,8,N,1

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Resources