Nucleo F401RE WiFi Connection

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.
User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Nucleo F401RE WiFi Connection

Post by ta1db » Fri Sep 27, 2019 5:09 am

Hi,
I would like to implement a wifi connection with Nucleo F401RE board using a cheap wifi module or shield preferable with ESP8266 E-01 .

Micropython firmware v1.11-312-g22099ab has network and socket modules, however - as far as I could see - the network module has only a "route" function which is also unknown for me.

Anybody implemented a wifi connection with this board or with any other similar STM32 board? I appreciate your comments and advise.

Thanks.

ps. on Nucleo F401RE board USART TX RX pins are reserved for ST-Link serial connection therefore I have to assign another serial channel to connect the ESP8266 01 wifi module.

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

Re: Nucleo F401RE WiFi Connection

Post by jimmo » Sun Sep 29, 2019 10:28 am

Hi,

I don't think such a thing has been implemented. If you ran the TCP stack on the Nucleo (1), then you'd need some sort of ethernet transport over the serial link. If you ran the TCP stack on the ESP (2), then you'd need to make a sockets-over-serial protocol.

That said... for (1), that's kind of what PPP is. I'm not aware of a PPP driver for the STM32 port though (or if there's a PPP driver for the ESP8266) but I haven't done any research.

For (2), this isn't what you asked for but still maybe useful. @pythoncoder and @kevinkk525 on this forum have a library for doing IOT stuff from MicroPython (in particular, it's a neat way of connecting to a LAN server), and they include "esp link" which is a kind of proxy for an ESP8266, which you can then connect to any MicroPython board (like your Nucleo). https://github.com/peterhinch/micropython-iot Worth checking out.

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Nucleo F401RE WiFi Connection

Post by ta1db » Sun Sep 29, 2019 4:27 pm

jimmo wrote:
Sun Sep 29, 2019 10:28 am
Hi,
For (2), this isn't what you asked for but still maybe useful.
Yes, this isn't what I've asked but can be a solution and seems attractive because on this occasion I also get familiar with ESP8266 as well, can be an introduction !

In the meantime I got an ESP8266 E01 wifi module which doesn't have a USB to UART converter on board and established connection over USART6, I send AT commands and listen responses over REPL a good start however difficult for AT programming.

I will order a PL2303 usb-serial adapter with 3.3V option-jumpers for this purpose however I also wander how can I implement a serial console on micropython as many people do the same with an Arduino https://cordobo.com/2300-flash-esp8266- ... duino-uno/

I know on nucleo boards we use usb virtual comm port to use for repl but perhaps it may be possible to open another virtual port, who knows :lol:

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

Re: Nucleo F401RE WiFi Connection

Post by jimmo » Sun Sep 29, 2019 10:53 pm

Oh yeah I completely forgot about the default AT firmware, which is essentially (2) also. I've used it in a couple of early ESP8266 before, it's pretty annoying to use though. See this thread viewtopic.php?t=551

Yep, you can make your Nucleo into a usb/uart adaptor. Unlike the AVR-based Arduinos it has several hardware uarts, so no need for software serial etc. It's just a matter of writing a loop to send the bytes backwards and forwards as they become available. You should look at pyb.USB_VCP

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Nucleo F401RE WiFi Connection

Post by ta1db » Mon Sep 30, 2019 9:46 am

jimmo wrote:
Sun Sep 29, 2019 10:53 pm
It's just a matter of writing a loop to send the bytes backwards and forwards as they become available. You should look at pyb.USB_VCP
Yes, I am fully agree. Yesterday I made a new build for Nucleo_F401RE as to have _thread module included ( was not existing in official distro) to simplify a full duplex comm. over uart , it is working quite well.

I will look at pyb.USB_VCP however, again, as far as I could see official STM32 distro doesn't include a class or function named as USB_VCP, I can try to put it into my own build.

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

Re: Nucleo F401RE WiFi Connection

Post by jimmo » Mon Sep 30, 2019 11:42 am

ta1db wrote:
Mon Sep 30, 2019 9:46 am
I will look at pyb.USB_VCP however, again, as far as I could see official STM32 distro doesn't include a class or function named as USB_VCP, I can try to put it into my own build.
Oh weird... I saw that it was an F401RE part which definitely has USB, but I just checked, the Nucleo board doesn't expose it, so the USB support is disabled in MicroPython.

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Nucleo F401RE WiFi Connection

Post by ta1db » Thu Oct 03, 2019 1:21 pm

I found this skin: https://www.tinyosshop.com/wifi-skin-for-pyboard

There are several discussions about this skin and about its subclass ESP8266 E-01 in this forum as well. Here in a micropython forum topic Damien recommends viewtopic.php?t=4883#p28432 this method as well: https://gitlab.com/goodwin-europe/raw-esp

Therefore I continue in this direction for both my own requirement and to contribute the community ( I saw several questions / trials on adding wifi onto the pyboard and similars ) ,

however I got a difficulty and appreciate if I get a help:

Summary: ESP8266 E01 wifi module works and do something but never say OK :roll:

Description: I've connected a ESP8266 E-01 wifi module to my uart port, it is working.. I am tracing the signals using a logic analyzer so TX RX are visible. If I reset E-01 wifi module in any way it always responds and sends information about its state so I understand it is healthy and the RX channel is operational. Also I can generate and send AT commands, I trace the signals reaching to the E-01 RX pin, once I could send AT+GMR and got the full version but I don't remember how I could succeed ?? Probably after a power on reset the module accepted my AT+GMR command and sent the following:

Code: Select all

Decoded Protocol Result
Sent	
AT+GMR
Received	
AT+GMR
AT' 'version:1.3.0.0(Jul' '14' '2016' '18:54:01)	
SDK' 'version:2.0.0(5a875ba)	
v1.0.0.3	
Mar' '13' '2018' '09:35:47	
OK
ets' 'Jan' '' '8''2013 COMMA rst' 'cause:4 COMMA' 'boot	' 'mode:(3 COMMA 0)		
wdt	' 'reset	
load' '0x40100000 COMMA
' 'len' '2408 COMMA	' 'room' '16' '	
tail' '8	
chksum' '0xe5	
load' '0x3ffe8000 COMMA' 'len' '776	COMMA' 'room' '0' '	
tail' '8	
chksum' '0x84	
load' '0x3ffe8310 COMMA' 'len' '632	COMMA' 'room' '0' '	
tail' '8	
chksum' '0xd8	
csum' '0xd8	
2nd' 'boot' 'version' ':' '1.6	
SPI' 'Speed' 40MHz	
SPI	' '	Mode:QIO
SPI	' '	Flash' 'Size' '&' 'Map:' '8Mbit(512KB+512KB)	
jump' 'to' 'run' 'user1' '@	' '1000
Above protocol and my descriptions may mean a lot for an experienced member of this forum. What could be wrong? Why this module doesn't say a small OK to me :cry:
Should I re-flash 8266 AT default firmware?
Thanks in advance..

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

Re: Nucleo F401RE WiFi Connection

Post by jimmo » Thu Oct 03, 2019 3:13 pm

What baud rate are you running the uart at? It's been a while since I last used the AT firmware but I have some vague recollection that the boot process happens at a fixed default baud rate but the AT mode is configurable. Do you have any luck at 9600, 57600 or 115200?

User avatar
ta1db
Posts: 53
Joined: Mon Sep 02, 2019 12:05 pm
Contact:

Re: Nucleo F401RE WiFi Connection

Post by ta1db » Thu Oct 03, 2019 4:02 pm

jimmo wrote:
Thu Oct 03, 2019 3:13 pm
What baud rate are you running the uart at?
After several trials using 115200 baud I've discovered that my wifi module has 26 MHz crystal oscillator and the default baud rate is 74880 baud ! not 115200 !
Module's user manual states:
ESP8266 chip itself supports 26MHz and 40MHz crystal, if the use of 40MHz
crystal, the default baud rate of 115200, if the use of 26MHz crystal, the UART0
power after the baud rate = 26 * 115200/40 = 74880, the letter can be ESP8266
Series modules are used 26MHz, because the general serial port tool does not support
the baud rate, so there will be printed on the garbled.
You can use the security serial interface assistant to configure the baud rate
74880 to view the startup information.
Note: part of the USB to TTL does not support 74880 baud rate, the computer
comes with RS232 to TTL does not support 74880 baud rate, recommend the use of
FT232, CP2102, CH340 and other chips.

I may have destroyed a part of firmware (perhaps) during my unsuccessful trials with 115200 because I couldn't succeed even with 74880.

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

Re: Nucleo F401RE WiFi Connection

Post by jimmo » Thu Oct 03, 2019 10:20 pm

Do you have a usb uart adaptor (e.g. ftdi) so you can try the eap8266 directly from your PC?

Otherwise just a random guess, are you sending the correct newlines with your AT commands?

My only other suggestion, can you share your code and I'll try it on one of my esp8266 and nucleo boards.

Post Reply