maixpy boot.py and fm/board_info


#1

I recently got my maix go kit and I’m trying to automatically connect to a WiFi AP on boot. I can connect with the sample code in the network module but when I try to put that in my boot.py it fails because fm and board_info objects aren’t available. What do I need to import to access these?

It also seems that globals in boot.py might not really be globals. I worked around the above by added a function to boot.py “def init_network(fm, board_info)” which includes a “global uart,net” line. I connect when I “import boot; boot.init_network(fm, board_info)” but then the net object seems to go out of scope and shuts down the wifi connection.


#2

I think you can write these code in your boot.py or _boot.py
from board import board_info
from fpioa_manager import *
import network
from machine import UART
fm.register(board_info.WIFI_RX,fm.fpioa.UART2_TX)
fm.register(board_info.WIFI_TX,fm.fpioa.UART2_RX)
uart = UART(UART.UART2,115200,timeout=1000, read_buf_len=4096)
nic=network.ESP8285(uart)
nic.connect(“your_uuid”,“you_password.”)
nic.ifconfig()
nic.isconnected()


#3

board_info import didn’t work but with fm available I was able to use the pin numbers instead of enums.