Hardware:
mikromedia Plus for PIC32MX7 --> https://www.mikroe.com/mikromedia-4-pic32mx7
mikromedia Plus for PIC32MX7 Shield --> https://www.mikroe.com/mikromedia-4-pic32mx7-shield
Software:
MikroC PRO for PIC32 v.4.0.0
Library: Ethernet --> https://libstock.mikroe.com/projects/vi ... et-library
After playing a couple of hours with this library, I managed to make it work. (Well work when there is a network connection). But there is a showstopper in this library and I was wondering if somebody ever figured out how to workaround it.
No ethernet cable connected issue
I have searched this forum, and there are mainly two types of answer from mikroE:
- Library was made with the assumption that there was always a connection available
- Try to send a packet and check to see if there's a reply
Library was made with the assumption that there was always a connection available
Why, I mean on what world does this ever happens? Do you think I bought a mikromedia to do "just" networking?
-If there is no connection available, the library just makes the microcontroller hang, you totally lose control of it. Only way to fix this is to reset the microcontroller. (If you search the forum, it's everywhere)
-So this renders the device unusable because there is no connection available? (It's a good thing mikroE doesn't make computers, no connection, you can't use your PC )
Try to send a packet and check to see if there's a reply
That actually is a good way, but to do that I would need to be able to have control over the microcontroller. But since the library just hangs, how am I supposed to do this?
Repro steps
It is pretty easy to make it hang. Just un-connect the cable and try to init. Just run this line:
Code: Select all
Net_Ethernet_Intern_Init(myMacAddr, myIpAddr, Net_Eth_Int_AUTO_NEGOTIATION & Net_Eth_Int_DEFAULT_MAC);
Why is there no time-out for this???
If there was then I could at least regain the control of my microcontroller and handle the "no connection" state. Now I can't.
So while the library is useful when you have a connection, it renders your device totally useless if you ever lose it.
Does anyone ever figured out how to handle this? Am I missing something? Or if you faced similar issue, what was your solution? (Changing hardware/library is an option if someone has a working solution)
Note: I also have mikroC AI for PIC32 but wasn't able to find any ethernet library...
Thanks
Dominic