Skip to content
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

esp-wifi: Examples broken #2883

Closed
bjoernQ opened this issue Jan 3, 2025 · 20 comments · Fixed by #2981
Closed

esp-wifi: Examples broken #2883

bjoernQ opened this issue Jan 3, 2025 · 20 comments · Fixed by #2981
Labels
package:esp-wifi Issues related to the esp-wifi package

Comments

@bjoernQ
Copy link
Contributor

bjoernQ commented Jan 3, 2025

On current main

  • wifi_embassy_access_point: DHCP server is not working anymore
  • Enterprise wifi connect seems to be broken (no example in the repo - used a local one - crashing with 'Load access fault') (works on tag 0.21.0 - not on 0.22.0)
@bjoernQ bjoernQ added the package:esp-wifi Issues related to the esp-wifi package label Jan 3, 2025
@github-project-automation github-project-automation bot moved this to Todo in esp-rs Jan 3, 2025
@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 3, 2025

Enterprise wifi broke with commit ca9ee23

Crash happens (on ESP32-C6 at least) when using atoi and/or strdup from ROM

@tommasoclini
Copy link
Contributor

Is this something that has to do with my example code?

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 10, 2025

Is this something that has to do with my example code?

I don't think so. Needs some more investigation

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 10, 2025

Enterprise Wifi is fixed

@jamessizeland
Copy link

jamessizeland commented Jan 14, 2025

link to matrix thread related: https://matrix.to/#/!LdaNPfUfvefOLewEIM:matrix.org/$4D3Y3fJtRd-Sb6s3zU8-FjdPt__7dRJs6xWvoOZBkaI?via=matrix.org&via=tchncs.de&via=envs.net

Wanted to add a note here that there seems to be an issue somewhere in the interaction of embassy and esp-wifi ble, for (at least) the c6, but not the c3.

We've noticed this in running the Trouble examples on the c6, but following back some breadcrumbs the same behaviour is being seen in the esp-generated template (with ble enabled but not with wifi), and when running https://github.com/esp-rs/esp-hal/blob/main/examples/src/bin/wifi_embassy_ble.rs

Behaviour appearing consistently on any subsequent flashes of the chip.

Stall occurring here:

unwrap!(interrupt::enable(
Interrupt::BT_MAC,
interrupt::Priority::Priority1
));

and deeper here:

intr_map_base
.offset(interrupt_number)
.write_volatile(cpu_interrupt_number as u32 + EXTERNAL_INTERRUPT_OFFSET);

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 14, 2025

Thanks. Just tried on latest commit (5717608) and wifi_embassy_ble example is working fine for me on ESP32-C6 (on both, "chip revision: v0.1" and "chip revision: v0.0"), ran the example multiple times compiled with different toolchains

@jamessizeland
Copy link

Ok espflash erase-flash has revived the chips, so I'll try to reproduce the fault again.

@eloycoto
Copy link

eloycoto commented Jan 14, 2025

Thanks. Just tried on latest commit (5717608) and wifi_embassy_ble example is working fine for me on ESP32-C6 (on both, "chip revision: v0.1" and "chip revision: v0.0"), ran the example multiple times compiled with different toolchains

Fails for me on the second flash, first one correct, second one fails.

Logs: https://pastebin.com/BpyUcD26

@jamessizeland
Copy link

Thanks. Just tried on latest commit (5717608) and wifi_embassy_ble example is working fine for me on ESP32-C6 (on both, "chip revision: v0.1" and "chip revision: v0.0"), ran the example multiple times compiled with different toolchains

Ok, I'm reproducibly getting the stall state by:

cargo espflash erase-flash
# unplug to depower
cargo xtask run-example esp-hal esp32c6 wifi_embassy_ble
# works as expected
# ctrl+r to reset the board or ctrl+c and reflash
# stalls at https://github.com/esp-rs/esp-hal/blob/571760884bf90240fdace3afdfb7f527194681aa/esp-wifi/src/timer/timer_esp32c6.rs#L29-L32

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 15, 2025

Aha ...... it always works fine for me when flashing/running via UART-bridge, but I see the same thing happening when flashing/running via Serial-JTAG - that's a hint.

Even funnier - even while connected to Serial-JTAG: stopping espflash and resetting the board makes the device show up in BLE Explorer etc. (and I can connect)

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 15, 2025

But e.g. wifi_ble example should show the same behavior, then. (and does for me - but wifi examples don't show this behavior) 🤔

@eloycoto
Copy link

@bjoernQ Do you have any idea where the problem can be? I'm a bit lost on the possible causes, so any hint, I'm happy to check if that it's the problem.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 16, 2025

What dev-board are you using? I'm using official DevKitC - and is it using a UART-bridge or JTAG-Serial?

@eloycoto
Copy link

waveshare devkit and using JTAG

@jamessizeland
Copy link

And I'm seeing the same behaviour on the Unexpected Maker Tinyc6 with the default interface, which I assume is JTAG.

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 16, 2025

Ok - I can definitely see weird behavior when serial-JTAG is used. I can't explain why it happens, but I know how to work around that.
I'm on it

@bjoernQ
Copy link
Contributor Author

bjoernQ commented Jan 16, 2025

#2981 fixes what I observed and (hopefully) will fix the problems you are facing (if not you encountered more than one problem - it's definitely part of the problems you see)

If possible, would be great if you can give that branch a try

@jamessizeland
Copy link

Awesome, will do in a couple of hours, thanks!!

@jamessizeland
Copy link

Confirmed working reliably on both of my c6 boards! @bjoernQ you are a genius.

@eloycoto
Copy link

I can confirm that it's working 🎉 Thanks!

@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:esp-wifi Issues related to the esp-wifi package
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants