accessing uart0 on nodemcu board

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
hwt9520
Posts: 2
Joined: Sun Dec 16, 2018 9:28 pm

Re: accessing uart0 on nodemcu board

Post by hwt9520 » Mon Dec 24, 2018 8:44 am

dariox wrote:
Sun Dec 23, 2018 9:37 pm
I've flashed the same boot.py, but still the same result. I'm currently running no main.py. FW is
esp8266-20180511-v1.9.4.bin
me too

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: accessing uart0 on nodemcu board

Post by Roberthh » Mon Dec 24, 2018 9:21 am

As Christian Walther told, you have to install a more recent firmware, like from today's daily build,

dariox
Posts: 8
Joined: Sat Dec 22, 2018 12:29 pm

Re: accessing uart0 on nodemcu board

Post by dariox » Mon Dec 24, 2018 2:08 pm

Ok, now it seems working. But when I put uos.dupterm(None, 1) into the terminal, it stops working, the terminal hangs.

kevinkk525
Posts: 969
Joined: Sat Feb 03, 2018 7:02 pm

Re: accessing uart0 on nodemcu board

Post by kevinkk525 » Mon Dec 24, 2018 2:12 pm

If you write: uos.dupterm(None, 1)
you disable the terminal output to UART so of course you dont see anything. Use the webrepl.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

dariox
Posts: 8
Joined: Sat Dec 22, 2018 12:29 pm

Re: accessing uart0 on nodemcu board

Post by dariox » Mon Dec 24, 2018 10:30 pm

OK, thx!

dariox
Posts: 8
Joined: Sat Dec 22, 2018 12:29 pm

Re: accessing uart0 on nodemcu board

Post by dariox » Tue Dec 25, 2018 3:36 pm

I'm now connected over the WebREPL and I can send the commands, but the response is somehow strange. I would expect something different.


>>> uart.write('AT+CFUN=1,1\r'.encode())
12


uart.read() or uar.readline() shows nothing..

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: accessing uart0 on nodemcu board

Post by Roberthh » Tue Dec 25, 2018 4:59 pm

12 is the number of characters sent.
Did you use the proper speed for your Modem?
Please consider that read() and readline() are not blocking. So if read() is called before the modem responds, you get nothing returned.

dariox
Posts: 8
Joined: Sat Dec 22, 2018 12:29 pm

Re: accessing uart0 on nodemcu board

Post by dariox » Wed Dec 26, 2018 3:47 pm

The modem runs at 9600 baudrate. What would be the right command to read the response instead of read() ?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: accessing uart0 on nodemcu board

Post by Roberthh » Wed Dec 26, 2018 4:35 pm

read() and readline() are good for reading when data is available. You can check with uart.any() if chaarcters are available, and wait for a while for the response from the modem.

flywire
Posts: 22
Joined: Wed Jan 02, 2019 7:08 am

Re: accessing uart0 on nodemcu board

Post by flywire » Thu Jan 03, 2019 8:25 am

@dariox - If you got this working can you post the code?

Post Reply