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.

CCS/TMS320F280049M: How to configure TMS320F280049M ADC SetVREF with external Reference Mode in the program

Part Number: TMS320F280049M

Tool/software: Code Composer Studio

When I started writing ADC module program in TMS320F280049M, I met a problem.   TI has given an example to how to set up ADC REF during ADC initialization  program  in f28004x_adc.c. the code is as follow:

void SetVREF(int module, int mode, int ref)
{
Uint16 *offset, offval;


offset = (Uint16 *)(0x70594 + (module * 6));

if((mode == ADC_INTERNAL) && (ref == ADC_VREF3P3))
{
offval = (*offset) >> 8; // Internal / 1.65v mode offset
}
else
{
offval = (*offset) & 0xFF; // All other modes
}


EALLOW;
switch(module)
{
case 0:
AdcaRegs.ADCOFFTRIM.bit.OFFTRIM = offval;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFASEL = mode;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFA2P5SEL = ref;
break;
case 1:
AdcbRegs.ADCOFFTRIM.bit.OFFTRIM = offval;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFBSEL = mode;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFB2P5SEL = ref;
break;
case 2:
AdccRegs.ADCOFFTRIM.bit.OFFTRIM = offval;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFCSEL = mode;
AnalogSubsysRegs.ANAREFCTL.bit.ANAREFC2P5SEL = ref;
break;
default:
break;
}
EDIS;
}

 when  the ref voltage in ADC module is 3.0 V  with external reference mode,  in my opinion, I should set parameter of mode  in this function with ADC_EXTERNAL, however, the ref voltage is 3V  not 2.5V and 3.3V, how should I to configure AnalogSubsysRegs.ANAREFCTL.bit.ANAREFC2P5SEL = ref, that is how to configure  the parameter of ref in fuction. 

Another question is when I saw the data sheet , I found a  ANAREFPP Register in  AnalogSubsysRegs which is related to how  to configure the ref voltage of  A、B and C module, and its description is as follow 


I wonder if I use TMS320F280049M with 64pins , ANAREFBDIS bit in  ANAREFPP  register is whether shoulde be congfigured in ADC initialization.

thanks!

Best regards!



  • Hi Jari,

    For the REF disable bits, the boot ROM should be taking care of this for you. You can verify this by reading the status of the bits in the expressions window at run-time.

    In external reference mode, setting of the internal reference range to 0 to 3.3V or 0 to 2.5V doesn't make any difference to the ADC operation. The ADC does need different offset trims for different modes, but the two conditions are:
    *3.3V range + internal reference mode
    *All other modes (2.5V intref, any extref)

    Since any external reference voltage uses the same offset trim value, the 0 to 3.3V range or 0 to 2.5V range again doesn't matter.

    We probably need to update the documentation for this function to be clearer; I'll submit a ticket for this.