AnsweredAssumed Answered

FRDM-KE06Z ADC incorrect reading saturated or crossed with SW3

Question asked by Matt Geerts on Jun 9, 2015
Latest reply on Jun 24, 2015 by vicentegomez

I am using PE to configure an ADC on FRDM-KE06Z board.

 

CASE 1:

Using static group which contains only CH0 reading on PTC1 (case 1b, using ch9 on PTF7)

Interrupt enabled.

Manually initialized module.

Begin Loop measurement

Interrupt triggers, I copy the value.

No matter what voltage I apply to the pin, the value is always 0xfff, 0xffe or 0xffd, but 90% of the time it is 0xfff.

When I press SW3, this value goes to 0!?

SW3 has nothing to do with ADC and no connection to PTC1 or PTF7, why would this happen? Why would I get saturated or zeroed values on ADC depending on SW3?

 

CASE 2:

Using static group which contains both CH0 reading on PTC1 and CH9 reading on PTF7

Interrupt enabled

Manually initialize module.

Begin Loop measurement

Interrupt never triggers.

Why would I not get an interrupt in CASE 2 when I get one in CASE 1 and the only difference is that the static group has two channels?

    

Thank you,

Matt

 

 

 

 

 

Snippet of init routine:

void ADC_Init()

{

      //Init the Feedback ADC
      mpLDD_HBridgeFeedback = HBridgeFeedback_Init((LDD_TUserData *) 0);
      if (mpLDD_HBridgeFeedback == 0)
      {
       return ErrHBridge_NoInit;
      }
      //Select the sample group (there is only one and it is 0)
      Error |= HBridgeFeedback_SelectSampleGroup(mpLDD_HBridgeFeedback,
      DEFAULT_SAMPLE_GROUP);
      //Start the measurement
      Error |= HBridgeFeedback_StartLoopMeasurement((LDD_TDeviceData*) 0); /* requires null pointer */
      if (Error != 0)
      {
       /* put a breakpoint here for debug purposes to see if HBridge is initialized safely*/
       __asm("nop");
      }

}

Interrupt triggered by ADC:

/* Record a Feedback ADC sample */
ErrHBridge HBridge_FeedbackComplete(void)
{
      uint16_t uwADC[2];
      volatile LDD_TError Error; /* Error catcher */
      /* Read the latest ADC value */
      Error = HBridgeFeedback_GetMeasuredValues(mpLDD_HBridgeFeedback,
        (LDD_TData*) (&uwADC[0]));
       if (Error != 0)
      {
       /* put a breakpoint here for debug purposes to see if HBridge is initialized safely*/
       __asm("nop");
      }
      return ErrHBridge_OK;
}

 

 

 

 

 

Outcomes