-
Notifications
You must be signed in to change notification settings - Fork 81
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
Bug in ATtiny85 (ADC in free running mode) #136
Comments
From a quick glance at the ADC peripheral code, it seems like this functionality was never implemented. If you want to try to implement it and send a pull-request, that might work. Otherwise, I can open it for voting, but I'm pretty sure it won't get much attention - the ADC has been out for more than a year, and no one every asked about the free running mode (until now, at least). |
Thanks for the quick reply! No need to open it for voting, I am exploring the Attiny features purely for educational purposes and I don't need this feature. Keep up the great work! |
I think to make it work, one would need to add a bit to this routine to schedule another completeADCRead dependent on Lines 192 to 205 in 320007d
But it gets complicated depending on the particular free running mode per The plain ADSCRB::ADTS[0:2]=0b000 free running mode trigger source might be a straightforward scheduling of a call to onADCRead(???), but the others trigger sources would seem to need something like interrupts.
Datasheet ADSCRB reference: https://onlinedocs.microchip.com/pr/GUID-0EC909F9-8FB7-46B2-BF4B-05290662B5C3-en-US-12.1.1/index.html |
Here is another bug of ADC freerunning mode in 328P https://wokwi.com/projects/393410516428554241.
|
I think there is a bug in the way the simulator handles ADC in free running mode.
This is a mode, documented in the datasheet, in which the ADC keeps sampling the chosen input.
In is configured using the ADCSRA and ADCSRB registers.
To reproduce the error I have prepared this sketch: https://wokwi.com/projects/353310932474416129
In the Wokwi simulation, there is only one message reaching the console.
In a physical Attiny85, the console keeps receiving messages, as it should.
BUG(?): It appears like the simulator somewhere does not properly re-start the ADC conversion.
This bug might (not checked) affect not just the free-running-mode (ADCSRB =0x00) but other interrupt-driven ADC-conversions as well (other values of ADCSRB).
The text was updated successfully, but these errors were encountered: