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.

ADCSequenceConfigure() bug in TivaWare for ADC1



Hi all,

I've found a bug when using ADCSequenceConfigure() to configure ADC1. When using this function to set a trigger source for ADC1, the ADC_TSSEL register for ADC1 never gets changed. This is because in adc.c version 2.1.3.156, line 551, we see this:

 if(ui32Gen >= ADC_TRIGGER_PWM0 && ui32Gen <= ADC_TRIGGER_PWM3)
    {
        //
        // Set the shift for the module and generator
        //
        ui32Gen = (ui32Gen - ADC_TRIGGER_PWM0) * 8;
        
        HWREG(ADC0_BASE + ADC_O_TSSEL) = ((HWREG(ADC0_BASE + ADC_O_TSSEL) &
                                          ~(0x30 << ui32Gen)) |
                                          ((ui32Trigger & 0x30) << ui32Gen));
    }

Note that in the HWREG macro, ADC0_BASE is hardcoded when instead ui32Base should be passed in. As is, only ADC0 can be configured properly and any calls to configure ADC1 triggers configure ADC0 instead. I ran across this bug when using ADC0 and 1 to simultaneously sample motor currents for a dual motor controller.


David