stm32f411 and sim800L

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
nesergen
Posts: 23
Joined: Mon Oct 26, 2020 9:17 pm

stm32f411 and sim800L

Post by nesergen » Mon Oct 26, 2020 9:37 pm

I'm trying to connect the stm32f411 board and the SIM800L gsm module. I have been suffering for several days. Rummaged through a bunch of manuals.
There is an assumption that the board is interacting with the module, but errors are constantly appearing. Now in more detail ....
I connected the boards according to this instruction:
Image
Uploaded the main.py sketch to the motherboard.

Code: Select all

import pyb, json,utime

print('START code...')
uart = machine.UART(1, 9600) 
print ("Test 2")
uart.write("AT\r")
utime.sleep(2)
print ("Test 3")
uart.read(8)
print ("Test 4")
I get infinite error:
pc ~ $ picocom /dev/ttyACM0
picocom v1.7

port is : /dev/ttyACM0
flowcontrol : none
baudrate is : 9600
parity is : none
databits are : 8
escape is : C-a
local echo is : no
noinit is : no
noreset is : no
nolock is : no
send_cmd is : sz -vv
receive_cmd is : rz -vv
imap is :
omap is :
emap is : crcrlf,delbs,

Terminal ready
START code...
Test 2
Test 3
MicroPython v1.13 on 2020-10-14; WeAct F411CE with STM32F411CE
Type "help()" for more information.
>>> machine.soft_reset()
MPY: sync filesystems
MPY: soft reboot
START code...
Test 2
Test 3
Test 4
MicroPython v1.13 on 2020-10-14; WeAct F411CE with STM32F411CE
Type "help()" for more information.
>>> ation.
Traceback (most recent call last):
File "<stdin>", line 2
SyntaxError: invalid syntax
>>> >>>
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>> SIM800 R14.18
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>>
>>> ERROR
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'ERROR' isn't defined
>>> ation.
Traceback (most recent call last):
File "<stdin>", line 2
SyntaxError: invalid syntax
>>> Traceback (most recent call last):
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>> File "<stdin>", line 2
Traceback (most recent call last):
File "<stdin>", line 1
IndentationError: unexpected indent
>>> SyntaxError: invalid syntax
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>> >>> >>>
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>> Traceback (most recent call last):
Traceback (most recent call last):
File "<stdin>", line 1
SyntaxError: invalid syntax
>>> File "<stdin>", line 1
Traceback (most recent call last):
File "<stdin>", line 1
IndentationError: unexpected indent
>>> SyntaxError: invalid syntax

Thanks for using picocom
Interestingly, the output contains information about the module
>>> SIM800 R14.18
. I suppose this proves that boards communicate. But why do other errors fall out? Moreover, no details about the reasons for the error are written. can anyone give some advice?

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: stm32f411 and sim800L

Post by jimmo » Mon Oct 26, 2020 10:49 pm

Is it possible that you're using the same UART that's used for the MicroPython REPL to talk to the GSM module? So MicroPython is trying to "execute" the output from the module?

davef
Posts: 811
Joined: Thu Apr 30, 2020 1:03 am
Location: Christchurch, NZ

Re: stm32f411 and sim800L

Post by davef » Mon Oct 26, 2020 11:42 pm

Just a ''heads-up" ... you do have 2G network access in your area.

nesergen
Posts: 23
Joined: Mon Oct 26, 2020 9:17 pm

Re: stm32f411 and sim800L

Post by nesergen » Tue Oct 27, 2020 6:37 am

jimmo wrote:
Mon Oct 26, 2020 10:49 pm
Is it possible that you're using the same UART that's used for the MicroPython REPL to talk to the GSM module? So MicroPython is trying to "execute" the output from the module?
Hmmmmmm..... Maybe you right :idea: . I will try this. Thanks!

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: stm32f411 and sim800L

Post by dhylands » Tue Oct 27, 2020 2:45 pm

The schematic also looks weird. It shows TxD on the MCU as being an input when in fact TxD in the MCU is an output, and RxD is the input.

For the MCU RTS is an output and CTS is an input, so that part looks OK.

nesergen
Posts: 23
Joined: Mon Oct 26, 2020 9:17 pm

Re: stm32f411 and sim800L

Post by nesergen » Wed Oct 28, 2020 7:09 am

Choosing a different UART port solved the problem. I knew about the error in the diagram with the connection of pins, so I did it right right away.
But I can't connect to the network, although there are many 2g networks in my area and the SIM card supports this mode. The module finds the networks, but not the ones I need. I will try to write a log to Flash memory and transfer the module to different places.

nesergen
Posts: 23
Joined: Mon Oct 26, 2020 9:17 pm

Re: stm32f411 and sim800L

Post by nesergen » Thu Oct 29, 2020 2:38 pm

I am trying to get a list of the operators of my location. But the received data is truncated. Please tell me why this is happening.

Code: Select all

b'AT+COPS=?\r\r\n+COPS: (1,"MOTIV","MOTIV","25020"),(1,"MTS","MTS","25'

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: stm32f411 and sim800L

Post by dhylands » Thu Oct 29, 2020 4:27 pm

You should increase the size of the Rx buffer.
http://docs.micropython.org/en/latest/l ... .UART.init

pass in an rxbuf which is bigger than the largest message you expect to receive.

Post Reply