How to include driver into micropython compilation

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
oneroan
Posts: 1
Joined: Fri Oct 01, 2021 2:36 am

Re: How to include driver into micropython compilation

Post by oneroan » Tue Aug 30, 2022 4:45 am

vinz-uts wrote:
Tue Nov 16, 2021 9:24 pm
For the `AssertionError: Expected 0x08.`, it seems is that the problem is in writing register on the chip. Are you sure your connected pin configuration is right. I had the same error when I had choose too high frequency for SPI. `htonl` and `htons` are function defined in `wiznet5k_socket`, so, if the import works, you have to be able to manually call these function.
Hi, I have this same problem. No matter I set spi baudrate to 100000, 200000, 1000000, 2000000, 4000000, 8000000. Result always be 0x0 not 0x08. Any suggestion?

brainelectronics
Posts: 2
Joined: Tue Jul 27, 2021 4:54 pm

Re: How to include driver into micropython compilation

Post by brainelectronics » Thu Sep 01, 2022 9:11 pm

I faced the same issues. Finally I decided to not define a reset output pin, which solved the issue of 0x08. If the pin shall be used, I had to explicitly turn it on and wait a short time before creating the network interface. See code example below. I use different SPI and CS pins than on the previous posts

Code: Select all

spi = SPI(1)
cs = Pin(15, Pin.OUT)
rst = Pin(19, Pin.OUT)
rst.on()
time.sleep(1)
nic = WIZNET5K(spi_bus=spi, cs=cs)

Post Reply