-
Notifications
You must be signed in to change notification settings - Fork 96
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
Support coex esp32c6 #300
Support coex esp32c6 #300
Conversation
Hi @bjoernQ, I have added new commit to workaround with coex of ESP32C6. I debugged with enabling When we trigger interrupt for tasks --> it makes the main function hangs up. I don't know the main reason of it. So I change the priority of After that, wifi and ble can work with coexist mode. But I has an issue with wifi Beside that, I just commented 2 functions |
Awesome you were able to make progress on this! 🚀
Probably a better solution would be to increase the amount of available CALLOUTS/CALLOUT_TIMERS/CALLOUT_EVENTS in
This one is really suspicious. It seems like it gets stuck in A last thing which might be a problem:
Unfortunately, that is not the key to make things work The thing about the |
* Split wifi state for AP and STA * Use atomic enum to store state * Clean up unnecessary unsafe blocks
It seems BLE is not fully work for ESP32C6. I tried to use: BLE started advertising but can't connect from my phone (I used "nRF Connect" App to scan and connect) I guess BLE now have issue. I tried using WIFI with coex and comment out Could you confirm on your side about BLE on ESP32C6 ? |
On the |
Hi @bjoernQ, Thanks for you confirmation. I have re-checked, BLE is OK (maybe yesterday I got some issues with my phone). I have pushed new commit: e0ebed9
Now, BLE and WIFI can work in Coex mode. But I still got an issue with WIFI as below picture. |
Awesome! Great achievement! I can run the coex example and even see the BLE advertisements after commenting in // println!("{:?}", ble.init());
// println!("{:?}", ble.cmd_set_le_advertising_parameters()); in the example again! I think the WARN logs are because at that moment the Bluetooth adapter got priority while the example wants to send data via WiFi - so the TX queue fills up. Once the WiFI adapter gets priority again the code is able to send the data. The thing that is really confusing me is that we need that workaround of logging "here" before and after that while loop. |
Even that loop itself shouldn't be necessary IMO - but the main task could trigger a The Tx token issue can be a misconfig or you might be running into the mutex bug we're in the process of fixing in another PR. In general, you should configure a longer tx queue than rx queue. This PR includes some changes that were already made. Please rebase instead of merge committing changes from main, it makes reviews a bit easier. This PR will also race with at least one of my other ones. Sorry for that, but I'm digging up the codebas in a shotgun-surgery way. This PR should probably be landed before my refactors. |
|
||
let current_timestamp = get_systimer_count(); | ||
critical_section::with(|_| unsafe { | ||
memory_fence(); | ||
for i in 0..TIMERS.len() { | ||
if let Some(ref mut timer) = TIMERS[i] { | ||
if timer.active && current_timestamp >= timer.expire { | ||
if timer.active && (current_timestamp >= timer.expire) { |
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.
This is unnecessary
@@ -33,14 +33,14 @@ pub extern "C" fn worker_task3() { | |||
|
|||
pub extern "C" fn worker_task2() { | |||
loop { | |||
let mut to_run = SimpleQueue::<_, 20>::new(); | |||
let mut to_run = SimpleQueue::<_, 40>::new(); |
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.
This should be unnecessary. We should just stop checking timers if this queue fills up, and we should loop back.
I also thought of using |
If worker_task1 doesn't run anything yet, not yielding from it means the timer will trigger a yield on timeout. So, there must be some difference between issuing a yield from an IRQ context vs thread context, maybe? |
Ok I guess I know what is going on - will create a PR tomorrow (hopefully) |
Thanks @bugadani, I have created new PR to be clear from draft PR here. |
I guess we can close this in favor of #327 |
Hi @bjoernQ,
I have forked this repo from "esp-rs" and do some workaround to support coex for esp32c6.
Basicially, I tried to run ble and wifi seperately with commands, and It can work:
cargo run --example ble --release --features "ble"
cargo run --example dhcp --release --features "embedded-svc,wifi"
But when I tried to use command:
cargo run --example coex --release --features "embedded-svc,wifi,ble"
I got an issue as below:
Could you help me review my changes and point me what should I do next ?
Thanks so much