Part Number: MSP430FR2355
Hi All
We are developing a system that needs the ADC to start a conversion after a exact period after a comparator has triggered. This time is in a small amount of us.
For this we intended to setup Timer1.CC1 to trigger the ADC. The timer is started when the COMP (comparator) triggers its interrupt. The Timer 1.CC1 signal ‘form’ is shown below:
____________
____| |__________________
DLY | TRG Pulse | Delay to next measure
As the Timer CC1 (which is used to trigger the ADC) has two outputs (one TB1.1A to P2.0 and one TB1.1B to ADC), we have directed the other to P2.0 and measuredon an oscilloscope to make sure we are getting the correct waveform we expect.
So, we confirmed all is OK with the signal from the timer, but we get the below behavior:
- ADC only triggers once, but doesn't look to be in sync with the rising edge of the pulse
- ADC then remain busy forever.
Other notes are:
- ADC works fine with a periodic software start (changing the trigger source of coarse).
- If we setup for software start and do not make a software trigger, then the ADC never triggers (as expected)
- Changing the length of the positive pulse makes no different
One of my worries is that is TB1.1A (measured) the same as TB1.1B?
Why would the ADC stay busy?
ADC setup code is below:
Many Regards
void InitialiseADCConverter(void)
{
ADCCTL0 &= ~ADCENC; // ADC Disabled to allow setup
ADCCTL0 = ADCSHT_2; // S&H=16 ADC clks
ADCCTL0 |= ADCON; // Turn ADC On
//ADCCTL0 |= ADCMSC; // Multiple conversions
ADCCTL1 = ADCSHS1; // Sample an hold trigger will come from Timer1 CCR1
ADCCTL1 |= ADCSHP; // Use the sampling Timer
// Default is no inversion (bit ADCISSH)
ADCCTL1 |= ADCDIV0; // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
ADCCTL1 |= ADCSSEL0 | ADCSSEL1; // Select the SMCLK (8MHz)
//Default is single channel Conversion (ADCCONSEQ0..1)
//No clock pre-scaler (ADCPDIV0.1)
ADCCTL2 |= ADCRES_1; // 10-bit conversion results
// Unsigned Binary result as default (ADCDF)
// ADC Buffer support 200Ksps as default(ADCSR)
ADCMCTL0 |= ADCSREF0; // Internal Reference
// Default input channel is 0 (ADCINCH0..3)
ADCIE |= ADCIE0; // Enable ADC conv complete interrupt
ADCCTL0 |= ADCENC; // Enable Conversions
//ADCCTL0 |= ADCSC // Start an ADC conversion
//Now we need to sort the reference or the ADC first start will be delayed
//whilst the ADC waits for the reference to be ready.
PMMCTL2 = 0; // this will be the 1.2V reference
PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.
}
void InitialiseADCConverter(void)
{
ADCCTL0 &= ~ADCENC; // ADC Disabled to allow setup
ADCCTL0 = ADCSHT_2; // S&H=16 ADC clks
ADCCTL0 |= ADCON; // Turn ADC On
//ADCCTL0 |= ADCMSC; // Multiple conversions
ADCCTL1 = ADCSHS1; // Sample an hold trigger will come from Timer1 CCR1
ADCCTL1 |= ADCSHP; // Use the sampling Timer
// Default is no inversion (bit ADCISSH)
ADCCTL1 |= ADCDIV0; // We will divide the clock by 2 to get a 4MHz ADC clock (Max 6.6MHz for 10 bit)
ADCCTL1 |= ADCSSEL0 | ADCSSEL1; // Select the SMCLK (8MHz)
//Default is single channel Conversion (ADCCONSEQ0..1)
//No clock pre-scaler (ADCPDIV0.1)
ADCCTL2 |= ADCRES_1; // 10-bit conversion results
// Unsigned Binary result as default (ADCDF)
// ADC Buffer support 200Ksps as default(ADCSR)
ADCMCTL0 |= ADCSREF0; // Internal Reference
// Default input channel is 0 (ADCINCH0..3)
ADCIE |= ADCIE0; // Enable ADC conv complete interrupt
ADCCTL0 |= ADCENC; // Enable Conversions
//ADCCTL0 |= ADCSC // Start an ADC conversion
//Now we need to sort the reference or the ADC first start will be delayed
//whilst the ADC waits for the reference to be ready.
PMMCTL2 = 0; // this will be the 1.2V reference
PMMCTL2 |= REFBGEN | REFGEN; // Enable the Internal voltage references
PMMCTL2 |= TSENSOREN; // Enable the temperature sensor.
}