Serial communication for BG95-M3 modem

Hello, dear friends

I’m starting my IoT development journey, and I really liked the support documentation both on the website and here.

I’m testing the modules present in the BG95-M3 modem and I’m currently having difficulties handling serial communication tests between the QuecPython terminal and the information return port. To perform this procedure, I used this post as a basis.
uart development

I’ve tried everything or almost everything, but now I’m trying to write and read strings on the terminal and on the COM port without success.

My setup:

  • Quectel BG95-M3 40pin out PCBA LPWA GSM NBIOT CATM Module Mini Development Board with GPS Receiver

  • USB 2.0 to TTL UART Serial Converter Adapter Programmable Module CH340 CH340G for Arduino 3.3V 5V Replace CP2102

Also adding images of the documentation that the seller provided me:

Code:

import _thread  # Import thread module
import utime  # Import timing module
import log  # Import log module
from machine import UART  # Import UART module

# Set log output level
log.basicConfig(level=log.INFO)
uart_log = log.getLogger("UART")
uart = UART(UART.UART1, 115200, 8, 0, 1, 0)

def uartWrite():
    global uart
    count = 10
    while count:
        write_msg = "Hello count={}".format(count)
        uart.write(write_msg)
        uart_log.info("Write msg :{}".format(write_msg))
        utime.sleep(1)
        count -= 1
    uart_log.info("uartWrite end!")


def UartRead():
    global uart
    while 1:
        msgLen = uart.any()
        utime.sleep(0.1)
        # Read when there exists data
        if msgLen:
            msg = uart.read(msgLen)
            utf8_msg = msg.decode()
            uart_log.info("UartRead msg: {}".format(utf8_msg))
        else:
            continue


def run():
    _thread.start_new_thread(UartRead, ())
    _thread.start_new_thread(uartWrite, ())

if __name__ == "__main__":
    run()
    while True:
        utime.sleep(0.5)

Drivers:
QuecPtyhon Terminal = Quectel Incorporated_2024-06-27_version30.0.72.20
COM Port = wch.n_2024-09-16_3.9.2024.9

Schematic:

GND = PIN 1 Development Board
RX(COM Port UART) - D-TXD Pin 3 Development Board
TX(COM Port UART) - D-RXD Pin 4 Development Board

P.s: I have also tried using the MAIN PORT (MAIN-TXD and MAIN-RXD), modifying the code to UART2.

Thanks for your attention and feel free to help me.

hi matheus
Thank you for your feedback

I confirmed the script and it looks normal.
Your problem is that the uart sends and receives data abnormally?
I think the problem may be caused by the wrong pin of the test. May I ask what your board is ?

1 Like

Hi Felix, thanks for the reply.

Here is the link to the development board:
development board

Here is the most complete documentation that the supplier provided: