AnsweredAssumed Answered

LPC546xx Internal ADC locking up

Question asked by George Chancellor on Aug 20, 2018
Latest reply on Sep 4, 2018 by Victor Jimenez

My ADC is setup to read 2 channels (channel 1 is sequence A, and channel 2 is sequence B).  Here is the setup code:

void ADC_ADCConfiguration(void)
{
   adc_config_t adcConfigStruct;
   adc_conv_seq_config_t adcConvSeqConfigStruct;

   /* Configure the converter. */
   adcConfigStruct.clockMode = kADC_ClockSynchronousMode; // Using sync clock source.
   adcConfigStruct.clockDividerNumber = 3; // Set ADC Clock to 60MHz = 180MHz / (3 + 1)
   adcConfigStruct.resolution = kADC_Resolution12bit; // Set ADC to 12 bit resolution
   adcConfigStruct.enableBypassCalibration = false; // We want to do a calibration
   adcConfigStruct.sampleTimeNumber = 0U; // Set 0 clock cycle before sampling starts   
   ADC_Init(ADC0, &adcConfigStruct); // Init ADC

   CLOCK_AttachClk(kSYS_PLL_to_ADC_CLK);

   

// Calibration after power up.
   if (!ADC_DoSelfCalibration(ADC0))
   {
      DebugMessages_WriteString("ADC Cal Failure\r\n");
      return;
   }

 

   // Enable conversion in Sequence A.
   adcConvSeqConfigStruct.channelMask = (1U << 0); // Include ADC 0
   adcConvSeqConfigStruct.triggerMask = 1U;
   adcConvSeqConfigStruct.triggerPolarity = kADC_TriggerPolarityNegativeEdge;
   adcConvSeqConfigStruct.enableSingleStep = false;
   adcConvSeqConfigStruct.enableSyncBypass = false;
   adcConvSeqConfigStruct.interruptMode = kADC_InterruptForEachConversion; // Enable the interrupt/DMA trigger.
   ADC_SetConvSeqAConfig(ADC0, &adcConvSeqConfigStruct);
   ADC_EnableConvSeqA(ADC0, true); // Enable the conversion sequence A.


   // Enable conversion in Sequence B.
   adcConvSeqConfigStruct.channelMask = (1U << 5); // Include ADC 5
   adcConvSeqConfigStruct.triggerMask = 2U;
   ADC_SetConvSeqBConfig(ADC0, &adcConvSeqConfigStruct);
   ADC_EnableConvSeqB(ADC0, true); // Enable the conversion sequence B.

 

   // Setup Seq B to override seq A
   ADC_SetConvSeqBHighPriority(ADC0);

}

If have high interrupts on the external hardware pins the ADC will lock up.  If I only enable sequence A or B it works perfectly at high interrupts.

 

When the lockup occurs it will not recover without a complete reboot.

 

Does anybody have any ideas on what could be causing the lockup?

Outcomes