Can not read data from uart with micropython and SIM7070G NB on ESP32 controller

1k Views Asked by At

I try to get my SIM7070G Cat-M/NB-IoT/GPRS HAT running with micropython on a ESP32 MC via UART. Unfortunately I did not find any libraries but I thought this can not be too difficult with micropython. I am working on this problem now for 3 days and do not get any response when sending commands with uart.

USB with computer: Sending AT commands gives an answer like sending AT and receiving OK.

Micropython:

from machine import UART
from time import sleep

sleep(1)
print("activate")
p = Pin(27, Pin.OUT, Pin.PULL_UP)
sleep(0.1)
p.on()
sleep(1)
p.off()

sleep(0.5)

print("activated")

uart = UART(1, 115200,rx=9,tx=10,timeout=5000)  
#uart.init(9600, bits=8, parity=None,rx=25,tx=26,stop=1)
uart.write(b'AT\r\n')
print("uart.write(b'AT\r\n')")
sleep(1)
data = uart.any()
print(str(data))

I just do not get a response. data is always 0.

What I tried:

  • checked connection 100 times, TX->RX and RX->TX, 5V, GND, PWR
  • different pins did not work
  • different baudrate... no difference.

Anyone a solution? That would be really great.

Link to manufacturer of SIM7070G HAT

1

There are 1 best solutions below

0
On

I figured out the solution. As @hcheung sais, I have to call AT command a few times (up until 10 times) to let the module get the baudrate. It will work than properly.