Well, basically I want two Atmega328p to communicate with each other. One of them has the task of receiving and processing data and the other has the task of sending this data to my HTTP server.
The problem is: the system that sends data has some strange problem with the serial, so that when I run a debug program that prints values from the serial, it always returns strange characters.
I've tried changing chips and PCBs. However, the same error appears.
The serial is configured on ports 2 and 3, using SoftwareSerial, since the main serial is being used for the GSM module that sends the data.
Two debug Arduinos are connected to the boards, they read the serial port of both and print everything that is written so that I can check that the communication is sending the correct data.
Debug Code:
void setup() {
// Inicializa a comunicação serial com a velocidade de 115200 bauds
Serial.begin(115200);
// Aguarda a conexão do monitor serial
while (!Serial) {
; // Espera a inicialização
}
}
void loop() {
// Verifica se há dados disponíveis para leitura na porta serial
if (Serial.available()) {
// Lê o dado recebido da porta serial
String receivedChar = Serial.readString();
// Imprime o dado recebido na porta serial
Serial.println(receivedChar);
}
}
Test Code:
#include <SoftwareSerial.h>
#define UART_BAUD 115200
#define PIN_TX 3
#define PIN_RX 2
SoftwareSerial SerialAT(PIN_RX, PIN_TX);
void setup() {
SerialAT.begin(115200);
Serial.begin(115200);
SerialAT.println("NX");
Serial.println("NX");
delay(100);
}
const unsigned long interval = 3600000;
void loop() {
SerialAT.println("NX");
Serial.println("NX");
delay(100);
}
This is what I get in the debug of one of the arduinos:
I've tested the separate systems as well, as I said above on other individual PCBs.


