Code Monkey home page Code Monkey logo

Comments (9)

bjoernQ avatar bjoernQ commented on July 24, 2024

My guess is that the problem is caused by the scheduling of the necessary tasks which need to run to make WiFi work

By default, the tick-rate (see https://github.com/esp-rs/esp-wifi/blob/main/esp-wifi/docs/tuning.md and

const DEFAULT_TICK_RATE_HZ: u32 = 100;
) is 100 Hz so it might take a long time until the main task gets a chance to run again. You can try another tick-rate (configured in cfg.toml) and see if that is enough to get it working

from esp-wifi.

darkwater avatar darkwater commented on July 24, 2024

It looks like it helps a little bit, although it's hard to tell for sure. Even at 1 Hz it still flickers. I've recorded two videos to give a better idea of what it looks like.

100hz.mp4
1hz.mp4

from esp-wifi.

bjoernQ avatar bjoernQ commented on July 24, 2024

I could imagine increasing the tick rate might help. There might still be problems if some code is run in a critical section which will delay switching to the main task but it might help

IIRC in the very beginning the default was even 1000 Hz

The thing here is that with a very high tick rate the CPU will spend a lot of time in just switching tasks but it takes longer until each task gets a chance to run

from esp-wifi.

MabezDev avatar MabezDev commented on July 24, 2024

RMT is very timing-sensitive, as @bjoernQ is suggesting. In esp-idf there are configuration options to store the RMT code in RAM, so that cache misses don't interrupt the transmission (we don't have an equivalent in Rust yet :(). Increasing the priority might also help here, but as @bjoernQ mentioned if there are long critical sections there will still be flickering.

from esp-wifi.

darkwater avatar darkwater commented on July 24, 2024

In esp-idf there are configuration options to store the RMT code in RAM, so that cache misses don't interrupt the transmission

What do you mean here? I’m new to ESP and haven’t used IDF. My understanding is that the hal blocks on the transmission and copies new data into the peripheral’s ram while the transfer is going on (which should mayhaps happen in an interrupt?). Is there another place to store the data for the peripheral to use?

from esp-wifi.

MabezDev avatar MabezDev commented on July 24, 2024

Is your code open source? It might be easier to help if we can see the code. Other than that I can only suggest general advice.

from esp-wifi.

darkwater avatar darkwater commented on July 24, 2024

Yeah, here it is: https://github.com/darkwater/home-leds

firmware/src/main.rs initializes esp-wifi amongst other things, and the call to RMT::transmit() is in firmware/src/ws2812_driver.rs

from esp-wifi.

bjoernQ avatar bjoernQ commented on July 24, 2024

A simple fix might be to run https://github.com/darkwater/home-leds/blob/48f39c9e8b55ffb0704709e077bdb8b5e3c09aa0/firmware/src/ws2812_driver.rs#L79 in a critical section - it should be fast enough to not interfere with esp-wifi

from esp-wifi.

darkwater avatar darkwater commented on July 24, 2024

Thanks, that does solve the flickering. I'll open an issue on the hal repo because that logic should probably be done in an interrupt handler, or at least documented to be susceptible to interference.

from esp-wifi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.