This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F2802x Peripheral Driver Library - bug in ADC_setIntMode(...) ?

Other Parts Discussed in Thread: CONTROLSUITE

Hi Folks, 

could you please check if ADC_setIntMode peripheral library function with ADC_IntMode_EOC  parameter works for you ? I have F28027 on my board and found out that calling

    ADC_setIntSrc(myAdc, ADC_IntNumber_1, ADC_IntSrc_EOC2 ); /* SOC 2 trigger */
    ADC_setIntMode(myAdc, ADC_IntNumber_1, ADC_IntMode_EOC); /* ignore the flag */
    ADC_enableInt(myAdc, ADC_IntNumber_1); /* Enable INT1 for ADC */

does not set correct bits in INTSEL1N2 register. The first function shall set INTSEL1N2 to 0x0002. The second shall set INTSEL1N2 to 0x0042 and the last one to 0x0062. 

However, I get 0x0023 as a result. Calling 

Calling 

ADC_setIntMode(myAdc, ADC_IntNumber_1, ADC_IntMode_EOC); /* ignore the flag */

with ADC_IntMode_EOC parameter sets bit 0 instead of bit 6. Same happens for bit 14. I assume there is a bug in the library. My code works flawlessly when I set  INTSEL1N2  manually using a debugger.

Library version is : C:\ti\controlSUITE\device_support\f2802x\v230\

I'll provide more details if needed. 

Best Regards, Jiri

  • Hi Jiri,

    You're right. I believe ADC_IntMode_e is supposed to look like this:

    //! \brief Enumeration to define the analog-to-digital converter (ADC) interrupt mode
    //!
    typedef enum
    {
        ADC_IntMode_ClearFlag=(0 << 6),     //!< Denotes that a new interrupt with not be generated until the interrupt flag is cleared
        ADC_IntMode_EOC=(1 << 6)            //!< Denotes that a new interrupt with be generated on the next end of conversion (EOC)
    } ADC_IntMode_e;

    I'll file a bug report.

    Thanks,

    Whitney

  • Whitney, thanks a lot for your prompt answer and confirmation.
    I modified adc.h from C:\ti\controlSUITE\device_support\f2802x\v230\f2802x_common\include\adc.h according to your suggestion and it works now. INT1CONT and INT2CONT are now set properly. I will revert the library file and rather workaround and document the bug it in my source code since the code is for a TI reference design.

    Best regards, Jiri