pyboard ethernet connection

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
story047
Posts: 1
Joined: Thu Jun 09, 2022 8:48 pm

pyboard ethernet connection

Post by story047 » Thu Jun 09, 2022 8:53 pm

Using a pyblitev1.0 and firmware update 'pyblitev10-20220117-v1.18.dfu' I'm trying to import network and use the WIZNET5k class to connect to my ethernet port.

code:
import pyb
import network
nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
print(nic.ifconfig())

returns:
Traceback (most recent call last):
File "<stdin>", line 6, in <module>
AttributeError: 'module' object has no attribute 'WIZNET5K'

I've double checked all of my connections and I have no idea for a fix. Thanks for your help,

doizuc
Posts: 1
Joined: Thu Jun 30, 2022 5:19 pm

Re: pyboard ethernet connection

Post by doizuc » Thu Jun 30, 2022 5:28 pm

Hi,

You've to flash the board with the network firmware, or compile the firmware yourself with the flag MICROPY_PY_NETWORK_WIZNET5K=5500 for the wiznet 5500 module.

It works fine for me with v1.18 and earlier.
However, it seems that for the latest firmware version v1.19.1 adding the flag at compilation or downloading the network version of the firmware doesn't append the module WIZNET5K to the network module, see extract from my terminal below. Any idea to solve this?

v1.18 wiznet5k module available:

Code: Select all

dfu-util --alt 0 -D ~/Downloads/pyblitev10-network-20220117-v1.18.dfu
screen /dev/tty.usbmodem385D386831342

MicroPython v1.18 on 2022-01-17; PYBLITEv1.0 with STM32F411RE
Type "help()" for more information.
>>> import network
>>> dir(network)
['__class__', '__name__', 'AP_IF', 'CC3K', 'STA_IF', 'WIZNET5K', 'route']
>>> import pyb
>>> nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
>>> print(nic.ifconfig())
('168.1.2.0', '255.255.255.0', '168.1.1.255', '8.8.8.8')
>>> 
v1.19.1 wiznet5k module NOT available:

Code: Select all

dfu-util --alt 0 -D ~/Downloads/pyblitev10-network-20220618-v1.19.1.dfu 
screen /dev/tty.usbmodem385D386831342

MicroPython v1.19.1 on 2022-06-18; PYBLITEv1.0 with STM32F411RE
Type "help()" for more information.
>>> import pyb
>>> import network
>>> nic = network.WIZNET5K(pyb.SPI(1), pyb.Pin.board.X5, pyb.Pin.board.X4)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'WIZNET5K'
>>> print(nic.ifconfig())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'nic' isn't defined
>>> dir(network)
['__class__', '__name__', 'AP_IF', 'CC3K', 'STA_IF', 'route']
>>> 

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

Re: pyboard ethernet connection

Post by jimmo » Fri Jul 01, 2022 12:00 am

story047 wrote:
Thu Jun 09, 2022 8:53 pm
I've double checked all of my connections and I have no idea for a fix. Thanks for your help,
doizuc wrote:
Thu Jun 30, 2022 5:28 pm
However, it seems that for the latest firmware version v1.19.1 adding the flag at compilation or downloading the network version of the firmware doesn't append the module WIZNET5K to the network module, see extract from my terminal below. Any idea to solve this?
Looks like a renaming in early-June broke this. I've sent https://github.com/micropython/micropython/pull/8842 to fix.

Post Reply