Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

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

$
0
0

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!




Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>