News for hackers. Stuff that matters.
Re:Booting Modern Intel CPUs by sgtnoodle on Monday April 17, 2023 @02:19AM (#35597355)
The ESP32 ADC is a dumpster fire. I used one to sample an analog signal at 8Khz, looking for 400uS wide pulses (pacemaker capture pulses.) I originally started with an interrupt that triggered conversion from software. It would completely miss pulses 10-20% of the time and instead drift around, as if the ADC was floating rather than connected to anything. I finally got it to work reliably by switching to DMA through the I2S peripheral.

Pretty much every hobby project I look at, people complain about how bad the ADC is, and then just proceed to take N samples and average them. It's not that the ADC is bad, it's that the underlying firmware is buggy. I suspect there's a race condition with the main CPU and a coprocessor that's using the ADC for some internal wifi stuff.

Re:Booting Modern Intel CPUs by rkagerer on Monday April 17, 2023 @02:51AM (#35597512)
Yeah I felt that pain :-).

On the ESP32-S3 ADC2 is shared with Wifi, but I don't think that's the case for ADC1. I made headway by throwing away all their boilerplate code and setting up the raw peripheral registers myself. I actually prefer it that way without all the abstraction underneath. Was getting nice results at 80kHz sample rate.

Would love to turn it into a write-up as I'm not sure anyone has done this before with that chip (at least I couldn't find any sample code around). It's actually all in MicroPython at the moment to boot... but wouldn't be hard to convert to C (and might even clean things up due to the more natural fit of that language working with bitfields). What I'd really like is to make it into a DMA-based ADC module for MicroPython but I'm not familiar enough with compiling that platform from scratch, particularly on Windows.

Re:Booting Modern Intel CPUs by matthewfcarlson on Monday April 17, 2023 @01:56PM (#35604182)
If you do end up writing it up, consider dropping it in the hackaday tip line (https://hackaday.com/submit-a-tip/). It sounds incredibly useful.