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

Add minimal support for Wi-Fi on the ESP32-S2. #309

Merged
merged 15 commits into from
Jan 13, 2025

Conversation

Frostie314159
Copy link
Contributor

@Frostie314159 Frostie314159 commented Jan 9, 2025

Hi,
this PR adds minimal support for the ESP32-S2 and delivers improvements to the ESP32 as well. I've modularized the patches to make porting to other chips easier. I'm not quite happy, with how that patching turned out, but AFAIK that's the best that's possible with the patch format. Now it's only necessary to figure out the offsets, of the individual components for the specific chip, to add minimal support for it. This also means, that all chips can benefit from research made on another, due to the Wi-Fi peripherals being so similar. (At times I had four instances of the Ghidra CodeBrowser running to cross-reference registers between chips.) Due to this, we were able to name a bunch more registers, which makes the driver code nicer to read.
This is still in draft status, because there are a few things I'd like to add around CTS/RTS and maybe the TSF.
I've adapted esp-wifi-hal to work with these patches on my local branch, which I'll make public soon.

If anyone is interested in the process of reverse engineering this, @redfast00 and I gave a talk about this on the 38C3.

As always, thanks a lot for considering this!

PS: I've ordered devkits for the S3 and C6. When they arrive, I'll attempt to make patches for those too.

@Frostie314159
Copy link
Contributor Author

Alright, I've removed the CTS_UNKNOWN field for the time being, as we aren't 100% sure about that yet. The driver and MAC stack still work without it anyway. I'll follow this up, with another PR soon, with some more advanced stuff, like TSF and potentially crypto. Right now, I'll try to port support for the C3, since I want to try this out on a RISC-V chip.

@Frostie314159 Frostie314159 marked this pull request as ready for review January 11, 2025 23:41
@Frostie314159
Copy link
Contributor Author

I just noticed, I'll have to make some last minute changes. It won't take long.

@Frostie314159
Copy link
Contributor Author

Alright, this is ready from my side. I had to decluster the TX parameter registers, since those offsets appear to be non-uniform across chips and I want porting to be as easy as possible. I have tested this again with esp-wifi-hal and foa, and since I still have a dancing parrot on my screen (one of the examples connects to an open network and sends a GET to parrot.live) this appears to work properly

Copy link
Member

@jessebraham jessebraham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patches look reasonable enough, and the fact that you have working examples is a pretty good indication that things are in good shape as well 😁 Thanks again for your contributions!

@jessebraham jessebraham added this pull request to the merge queue Jan 13, 2025
Merged via the queue into esp-rs:main with commit 2079642 Jan 13, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants