-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lwIP_ESPHost - using interrupt #2036
lwIP_ESPHost - using interrupt #2036
Conversation
For the 2nd problem, how is this different from the other Ethernet drivers? I'm not sure I understand it. When using IRQs the callback here does the processing which keeps the LWIP locked: arduino-pico/libraries/lwIP_Ethernet/src/LwipIntfDev.h Lines 431 to 438 in 77209a1
The only gotcha is the sendFrame call needs to mask off all Ethernet GPIO IRQs during processing, like here, to avoid Ethernet re-entrancy/deadlock: arduino-pico/libraries/lwIP_w5100/src/utility/w5100.cpp Lines 280 to 281 in 77209a1
...all the sendFrame procesing, finishing with... arduino-pico/libraries/lwIP_w5100/src/utility/w5100.cpp Lines 312 to 314 in 77209a1
Also, the LWIP mutex also disables GPIO IRQs while held so you don't end up with a packet coming in while other LWIP stuff is ongoing. arduino-pico/cores/rp2040/lwip_wrap.cpp Lines 43 to 46 in 77209a1
arduino-pico/cores/rp2040/lwip_wrap.cpp Lines 74 to 76 in 77209a1
|
sorry, I forgot to check the other lwip_X for recent changes. I will try to use |
540fe0a
to
c30ead2
Compare
ok. |
c30ead2
to
0b1c5c6
Compare
I didn't have much time. Today I continue the testing and I want to do a PR for the interrupt change state setting, which would be merged before this one. |
0b1c5c6
to
5300d35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I attempt to make the ESPHost work with interrupt. There are two problems.
First problem is small. The DATA_READY pin is active HGH with esp_hosted. So we need a way to return from RawDev the state for interrupt.
Second problem is big. The semaphores don't work. It is a problem without the interrupt too, but with the interrupt version
handlePackets
doesn't run in async_context so there is no locking.ethernet_arch_lwip_begin/end
only guards code executed within async_context so using it elsewhere doesn't stop the code executing. It only blocks handlePackets if executed from the timer worker.