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

ps-min-modem / ps-max-modem not working on esp32c3 #1619

Closed
rbomze opened this issue Mar 22, 2024 · 3 comments
Closed

ps-min-modem / ps-max-modem not working on esp32c3 #1619

rbomze opened this issue Mar 22, 2024 · 3 comments
Labels
package:esp-wifi Issues related to the esp-wifi package

Comments

@rbomze
Copy link

rbomze commented Mar 22, 2024

Hi,
today i extensively experimented with esp-rs in combination with esp-wifi and embassy-rs on the esp32 platform.
On a esp32c3 everything works fine as long there is no modem sleep enabled. Enabling eg. ps-min-modem via a feature for esp-wifi, allows to connect to an AP without any problems, but any further connection attempts via socket fail.
Not a single packet is received on the other side (i am getting 'ConnectionResets' as a fault).

Curious, because i was always using modem sleep in all esp-idf projects before (on the 'classic' esp32, where it is the default btw.) i tried to run (almost) the identical code on a 'classic' esp32. This time 'ps-min-modem' (and 'ps-max-modem') worked without any problems.
The only real difference between both codes are the timers:

    #[cfg(target_arch = "riscv32")]
    let timer = esp_hal::systimer::SystemTimer::new(peripherals.SYSTIMER).alarm0;
    #[cfg(target_arch = "xtensa")]
    let timer = esp_hal::timer::TimerGroup::new(peripherals.TIMG1, &clocks).timer0;

Could it be that the alarm0 timer is kind of too inaccurate to handle the right timing of the beacons and DTIMs? Btw. i tried different intervals for the the beacons [between 100-500] and DTIMs [between 2-5] - on the esp32c3 nothing worked with modem sleep enabled, on the esp32, as expected, i got more latency with higher intervals, but it always worked.

@bjoernQ
Copy link
Contributor

bjoernQ commented Mar 25, 2024

I just tried it and both, ps-min-modem and ps-max-modem work fine for me running on ESP32-C3. (Connecting to Fritz!Box 5590 as AP)

I don't think the 16MHz clock is too inaccurate for the job. I assume besides using a different all the setup is the same?
I assume you are running in --release mode? Non-release mode might work but is not recommended/supported.

@rbomze
Copy link
Author

rbomze commented Mar 27, 2024

I just tried it and both, ps-min-modem and ps-max-modem work fine for me running on ESP32-C3. (Connecting to Fritz!Box 5590 as AP)

I'll try tomorrow with other APs.

I don't think the 16MHz clock is too inaccurate for the job. I assume besides using a different all the setup is the same? I assume you are running in --release mode? Non-release mode might work but is not recommended/supported.

Yes, i was running the code in --release mode.
I will investigate further. I'll try the code on the bare hal, without embassy-rs. If nothing helps i pull out my oscilloscope and check the timings.

ps. if the socket communication is done directly after a wifi connect, without any delay, it works. it stops to work if the communication attempts are made after some time idling.

@bjoernQ bjoernQ transferred this issue from esp-rs/esp-wifi-sys May 27, 2024
@bjoernQ bjoernQ added the package:esp-wifi Issues related to the esp-wifi package label May 27, 2024
@bjoernQ
Copy link
Contributor

bjoernQ commented Jul 15, 2024

I don't think there is anything actionable right now since I am not able to reproduce this. Feel free to re-open

@bjoernQ bjoernQ closed this as completed Jul 15, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in esp-rs Jul 15, 2024
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

No branches or pull requests

2 participants