A mechanism to allow ADC to perform ad-hoc single conversions (ASC) without affecting the scheduled conversions is provided. The ADC sequencer slots the ASC request at a time when it finds an idle window in the middle of scheduled conversions without affecting the timing integrity of the scheduled conversions.
This is requested through the CTL3 register, which
has fields for specifying the ADC channel number, voltage reference option, and
sample period for conversion. Any write to this register is treated as ad-hoc single
conversion request by the sequencer. There is a separate result register available
to store the data for ad-hoc single conversion (ASCRES). This is a dedicated
register for ad-hoc single conversion operation which is different than result
registers/FIFO available to store results from conversion on sensor channels.
Once software writes into the ASC configuration register for ad-hoc single conversion there is a status bit that indicates the ASC is active (ASCACT) and goes low once the ASC operation is completed.
When the ASC operation is completed, an interrupt flag ASC done (ASCDONE) is set that can be unmasked by the software to read the ASC result in the interrupt service routine.
The software can write into the ASC configuration register at any time in an ad-hoc manner and that request is registered by the sequencer and serviced at a suitable time.
Figure 17-4 shows the ADC sequencer state-machine for ASC operation.
Repeat Single Channel Mode and ASC Request
- When the sequencer operates in a repeat single channel with sample trigger policy as auto-next, then the selected sensor channel is converted back to back continuously and the ASC request is pended by the sequencer and taken up and serviced only when the software stops repeat single channel conversion. When the sample trigger policy is trigger-next, then upon ASC request, the sequencer tries to schedule the ASC operation at the end of ongoing conversion (end of conversion [EOC]).
- It starts ASC operation and will complete it successfully if the scheduled trigger on the sensor channel does not arrive in between.
- If the scheduled trigger is received in the middle of the ASC operation, then ASC conversion is aborted immediately and scheduled conversion is performed.
- If the sequencer is not successful in completing ASC operation in the middle of scheduled conversions, then it will be serviced only when the software stops repeat single-channel conversions.
Sequence of Channels mode and ASC Request
- In the case of a sequence of channels operation with a sample trigger policy as auto-next for all channels in the sequence, the ASC request will be slotted at the end of the sequence and completed.
- If the sample trigger policy is trigger-next for one or more channels in the sequence, then the sequencer tries to schedule the ASC operation at the EOC of the channel with trigger next policy set.
- If it cannot complete ASC conversion successfully due to the arrival of the scheduled trigger then ASC operation is taken up and completed at the end after the conversion of all channels in the sequence are completed.
Repeat Sequence of Channels Mode and ASC Request
- In the case of a repeat sequence of channels operation with the sample trigger policy as auto-next for all channels in the sequence, the ASC request will be slotted and completed when the repeat sequence operation is stopped by the software.
- If the sample trigger policy is trigger-next for one or more channels in the sequence, then the sequencer tries to schedule the ASC operation at the EOC of the channel with the trigger-next policy set.
- If it can't complete ASC conversion successfully due to the arrival of the scheduled trigger then ASC operation is taken up and completed when the repeat sequence operation is stopped by software.
ASC Operation Abort Due to Scheduled Trigger
- When the scheduled trigger arrives during the sample phase of ASC operation then the sequencer pulls the sample signal low immediately, and applies reset to ADC SAR logic, and then generates a sample trigger for the scheduled conversion.
- When the scheduled trigger arrives during the conversion phase of ASC operation then sequencer applies reset to ADC SAR logic and then generates a sample trigger for the scheduled conversion.
- When the ASC operation gets aborted due to the arrival of the scheduled trigger, the sequencer attempts to perform the ASC operation automatically at the next earliest idle slot without software requiring to reissue ASC request.
- ASC request is not pipelined which means software has to issue ASC request only when ASC active status is low.
- If an ASC request is raised while the previous ASC operation is not completed then that ASC request is ignored and the software has to reissue the ASC request when the ASC active is low.