Page 1 of 1

How to include driver into micropython compilation

Posted: Wed Jan 23, 2019 7:33 am
by nedoskiv
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.

Re: How to include driver into micropython compilation

Posted: Wed Feb 27, 2019 2:42 pm
by nedoskiv
Come one people, just a little push here.

Re: How to include driver into micropython compilation

Posted: Wed Feb 27, 2019 3:44 pm
by torwag
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.

Re: How to include driver into micropython compilation

Posted: Sat Mar 16, 2019 6:26 pm
by nedoskiv
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?

Re: How to include driver into micropython compilation

Posted: Mon Mar 25, 2019 7:39 pm
by Picasso
Would this problem be avoided if the wiznet5k drive was written in python? Or would that have been impossible?

Re: How to include driver into micropython compilation

Posted: Wed Mar 27, 2019 9:35 am
by pythoncoder
@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.

Re: How to include driver into micropython compilation

Posted: Wed May 08, 2019 11:42 am
by nedoskiv
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?

Re: How to include driver into micropython compilation

Posted: Wed May 08, 2019 12:21 pm
by jimmo
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.