Hi,
There is no note for that mode in ADC-Section of Datasheet (only Single conversion by hand or event-controlled).
But in Errata they write something from ADC Free Running mode... Who knows more about that missing feature?
Franz
Hi,
There is no note for that mode in ADC-Section of Datasheet (only Single conversion by hand or event-controlled).
But in Errata they write something from ADC Free Running mode... Who knows more about that missing feature?
Franz
Free running mode - RIP
Never used it or needed it...
Jim
@Jim, do you know for sure that they dropped it?
@OP, I cant answer your question for sure, but iotn1616.h has this;
/* ADC - Analog to Digital Converter */ /* ADC.CTRLA bit masks and bit positions */ #define ADC_ENABLE_bm 0x01 /* ADC Enable bit mask. */ #define ADC_ENABLE_bp 0 /* ADC Enable bit position. */ #define ADC_FREERUN_bm 0x02 /* ADC Freerun mode bit mask. */ #define ADC_FREERUN_bp 1 /* ADC Freerun mode bit position. */ #define ADC_RESSEL_bm 0x04 /* ADC Resolution bit mask. */ #define ADC_RESSEL_bp 2 /* ADC Resolution bit position. */ #define ADC_RUNSTBY_bm 0x80 /* Run standby mode bit mask. */ #define ADC_RUNSTBY_bp 7 /* Run standby mode bit position. */
and Start generated this in adc_basic.c;
ADC0.CTRLA = 1 << ADC_ENABLE_bp /* ADC Enable: enabled */ | 0 << ADC_FREERUN_bp /* ADC Freerun mode: disabled */ | ADC_RESSEL_10BIT_gc /* 10-bit mode */ | 0 << ADC_RUNSTBY_bp; /* Run standby mode: disabled */
but, the Start configurator does not even have a way to select Free Running mode.
Per the Errata, Free Running mode exists with the caveats noted. Go for it, set bit 1 in the ADC CTRLA register and see if it works!
@Jim, do you know for sure that they dropped it?
No, just commenting on what OP said.
Jim
Being really old and such, I'm not well versed in e.g. Xmega-style event systems. For this question, I scanned the ADC register descriptions for this model family. In AVR8, free-running was one of the auto-trigger ADATE choices. Here all I can find is
But what event on which peripheral? Hmmm--does every event on every peripheral have an associated flag "when I fire also start an ADC conversion"?
EVSYS - The Event System, chapter 14 in the datasheet, has all the information on setting which event generator feeds which event trigger. It's more complicated than that, just summarizing.
14. EVSYS - Event System
14.1 Features
• System for direct peripheral-to-peripheral signaling
• Peripherals can directly produce, use, and react to peripheral events
• Short and guaranteed response time
• Up to six parallel Event channels available; 4 asynchronous- and 2 synchronous
• Channels can be configured to have one triggering peripheral action and multiple peripheral users
• Peripherals can directly trigger and react to Events from other peripherals
• Events can be sent and/or received by most peripherals, and by software
• Works in active mode and standby sleep mode
14.2 Overview
The Event System (EVSYS) enables direct peripheral-to-peripheral signaling. It allows a change in one
peripheral (the Event Generator) to trigger actions in other peripherals (the Event Users) through Event
channels, without using the CPU. It is designed to provide short and predictable response times between
peripherals, allowing for autonomous peripheral control and interaction, and also for synchronized timing
of actions in several peripheral modules. It is thus a powerful tool for reducing the complexity, size, and
execution time of the software.
A change of the Event Generator's state is referred to as an Event, and usually corresponds to one of the
peripheral's interrupt conditions. Events can be directly forwarded to other peripherals using the
dedicated Event routing network. The routing of each channel is configured in software, including event
generation and use.
Only one trigger from an Event generator peripheral can be routed on each channel, but multiple
channels can use the same generator source. Multiple peripherals can use events from the same
channel.
A channel path can be either asynchronous or synchronous to the main clock. The mode must be
selected based on the requirements of the application.
The Event System can directly connect analog and digital converters, analog comparators, I/O port pins,
the real-time counter, timer/counters, and the configurable custom logic peripheral. Events can also be
generated from software and the peripheral clock.
Just an observation:
The ADC doesn't generate events, it only accepts them (and starts a conversion). So it's not possible to simulate free running mode using the event system.
If the ADC generated a conversion complete event, we could connect it to itself through the event system.
Once again a topic is result of faulty, incomplete datasheet...
Of course, Free Running Mode is supported!
All explanations to this mode as described for ATTiny2/4/814
have been deleted in 1614 datasheet, incomprehensibly.
My code using Free Running Mode and including nice new sample accumulation
works perfectly :)
Just an observation:
The ADC doesn't generate events, it only accepts them (and starts a conversion). So it's not possible to simulate free running mode using the event system.
If the ADC generated a conversion complete event, we could connect it to itself through the event system.
As shown in datasheet's event system section ADC doesn't generate events.
But "simulation" of free running mode is possible if periodic timer events are used to trigger ADC conversions.
Luckily that is unnecessary...
Yup, it seems the Ministry of Truth at Atmel decided that there never was a free running mode
In fact they went so far that they removed the usual information present in reserved bits...
So, how does one trigger the ADC in software? Is setting STARTEI in EVCTRL sufficient (assuming that it is enabled, has a clock, and such)? How does software detect that a new conversion is ready?
Thanks
Jim
It seems the OP already confirmed that it works. See the post marked as solution.
It seems the OP already confirmed that it works. See the post marked as solution.
Is setting STARTEI in EVCTRL sufficient
I've not worked with this chip yet, but it sounds a lot like the Xmegas.
I think, however, you are getting ahead of yourself.
Think of the Event System as an optional system that allows some peripherals to pass data in the background, without direct core-micro intervention/processing.
One would, I think, first write a test program or two for the peripheral using the "usual" method, where the micro reads, processes, and writes data based upon an interrupt trigger, (or directly, without even using interrupts).
Once that works, then one could experiment with assigning peripherals to an Event channel, and letting the Event System process the data transfers in the background.
JC
Is setting STARTEI in EVCTRL sufficient
One would, I think, first write a test program or two for the peripheral using the "usual" method, where the micro reads, processes, and writes data based upon an interrupt trigger, (or directly, without even using interrupts).
Once that works, then one could experiment with assigning peripherals to an Event channel, and letting the Event System process the data transfers in the background.
Jim will have his ATmega4809 soon, he can play with EVSYS on it.