I'm trying to use a Pololu A-Star 328PB to control a SIM7020G NB-IOT module. I've used the SIM 7020 standalone using a Sparkfun FTDI serial to USB converter to issue AT commands to the module with success. The wiring diagram for that is as follows:
SIM 7020G -> Sparkfun FTDI
TX -> RX
RX -> TX
GND -> GND
I've moved on to try and control the SIM module with the Pololu board. I chose this specific Pololu board because the ATMEGA 328PB has 2 USART so I could have one used for serial monitor debugging and the other used for communication with the SIM module. The wiring diagram for this is as follows:
SIM 7020G -> Pololu Board
TX -> RX
RX -> TX
The Pololu board is connected/powered via the Sparkfun FTDI serial to USB converter board and in both instances described above the SIM module is powered by 2 18650 batteries.
The code I am using to try and communicate from the SIM board to the Pololu board and then output to the serial monitor is below.
void setup() {
Serial.begin(115200);
Serial1.begin(115200);
}
void loop() {
Serial1.println("AT");
Serial1.flush();
while (!Serial1.available());
char payload = Serial1.read();
Serial.println(payload);
Serial.flush();
delay(2500);
}
The output on the serial monitor has been an odd mix of the initial "AT" command followed by some incoherence then just outputting "A", rather than the expected "OK" output that should be present when "AT" is input to the SIM module.
I bought two of the same SIM modules and have tried both of them as well as another of the same Pololu boards with this code and wiring setup with identical results. Any ideas as to why this is happening?