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.
nedoskiv
Posts: 20
Joined: Fri Jan 18, 2019 10:48 am

How to include driver into micropython compilation

Post by nedoskiv » Wed Jan 23, 2019 7:33 am

Hello,

I'm new here, but stuck on some place, I want to include wiznet5k support into micropython used on esp32, so I followed some instructions/tutorials and manage to compile micropython, but after some reading was unable to understand how to include a driver or anything into compilation. According to this post: viewtopic.php?t=2842
I just need to copy .py file, but nothing make sence since there is no .py file in : /Micropython/esp32/micropython/drivers/wiznet5k

ethernet internet README.md

folder contain 2 folders and a readme file.

Someone please point me in right direction.

nedoskiv
Posts: 20
Joined: Fri Jan 18, 2019 10:48 am

Re: How to include driver into micropython compilation

Post by nedoskiv » Wed Feb 27, 2019 2:42 pm

Come one people, just a little push here.

torwag
Posts: 220
Joined: Fri Dec 13, 2013 9:25 am

Re: How to include driver into micropython compilation

Post by torwag » Wed Feb 27, 2019 3:44 pm

Hi,

I think you need to make yourself more clear what you want to achieve.
There are basically two things...

1. Compile a micropython firmware including some drivers... that is on a C-level compiling stuff in the same way you compile any other firmware.
2. Using some python modules to access drivers or directly talk to other hardware... that is on the python side

As far as I understood you mix both up trying to use a C-based driver lib and copy it over the pythonic way.
If the micropython-firmware you build and flashed includes the wiznet5k driver, you will be able to access it directly via the network module.

https://docs.micropython.org/en/latest/ ... NET5K.html

However, from a very very quick look, the ESP32 port does not include the driver and therefore you can't find it. I would need to check what is the reason about it. Thus, next step might be to figure out whether it can be easily added to the esp32 port.

nedoskiv
Posts: 20
Joined: Fri Jan 18, 2019 10:48 am

Re: How to include driver into micropython compilation

Post by nedoskiv » Sat Mar 16, 2019 6:26 pm

Thank you for the answer,

I will try to make myself clear
goal that I want to achieve is using wiznet 5k adapter with esp32, if not possible - use an other wired network adapter wits esp32, since I read about that, wiznet looks more stable solution if I manage to get it working.
I have download souces and compile them on an Ubunto , producing a binary file. Problem for me is that i not see any configuration file for the build. I'm not expert, that is why I ask how to do it.

You saying thet there is not wiznet driver for esp32, should I start an issue at github?

Picasso
Posts: 39
Joined: Fri Mar 22, 2019 12:13 pm

Re: How to include driver into micropython compilation

Post by Picasso » Mon Mar 25, 2019 7:39 pm

Would this problem be avoided if the wiznet5k drive was written in python? Or would that have been impossible?

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: How to include driver into micropython compilation

Post by pythoncoder » Wed Mar 27, 2019 9:35 am

@nedoskiv A glance at the docs shows that the driver is specific to the Pyboard [hint: look at the connections: they are Pyboard-specific]. The source for the driver shows that it was originally vendor-written in C.

My guess is that porting it to another platform may be nontrivial.

What problems are you getting with ESP32 WiFi? With the latest firmware it's been stable in my testing. Maybe we can help with specific WiFi issues.
Peter Hinch
Index to my micropython libraries.

nedoskiv
Posts: 20
Joined: Fri Jan 18, 2019 10:48 am

Re: How to include driver into micropython compilation

Post by nedoskiv » Wed May 08, 2019 11:42 am

If I do not mistaken, somewhere I have read that esp32 is merged with main, does that mean wiznet5k driver should be available for esp32 now?

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

Re: How to include driver into micropython compilation

Post by jimmo » Wed May 08, 2019 12:21 pm

Unfortunately no. The wiznet driver is only used in the STM32 port. The vendor driver is in drivers/wiznet5k, but see that the actual use of this driver is in ports/stm32/modnwwiznet5k.c (and ports/stm32/network_wiznet5k.c) (I agree this is a bit confusing because other directories in drivers/ are just python files that you could use directly).

For this to work for ESP32, someone would need to do the equivalent code in ports/esp32 to use the vendor driver.

vinz-uts
Posts: 22
Joined: Fri Sep 10, 2021 9:22 am

Re: How to include driver into micropython compilation

Post by vinz-uts » Fri Nov 12, 2021 9:25 pm

Hi, I've done some test with a ESP32-WROVER-IE and an external SPI Wiznet5500 ethernet chip. After a lot of research on this forum and github, I've decided to try to modify a pure-python adafruit driver (developed for circuitpython) for this chip. Now it seems works, but maybe it need more test. I can share this driver if someone will try to use it, or, if someone help me to understand the right steps, I will upload it in the right folder of micropython repo.

pdinoto
Posts: 3
Joined: Fri Jan 10, 2020 3:32 pm

Re: How to include driver into micropython compilation

Post by pdinoto » Sat Nov 13, 2021 11:07 am

vinz-uts wrote:
Fri Nov 12, 2021 9:25 pm
Hi, I've done some test with a ESP32-WROVER-IE and an external SPI Wiznet5500 ethernet chip. After a lot of research on this forum and github, I've decided to try to modify a pure-python adafruit driver (developed for circuitpython) for this chip. Now it seems works, but maybe it need more test. I can share this driver if someone will try to use it, or, if someone help me to understand the right steps, I will upload it in the right folder of micropython repo.
Hi, this is very interesting, i have several boards with ESP32 and W5500 chip. Can you share your work?
Thank you.

Post Reply