Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 63683

Forum Post: RE: Silicon (?) problem with MSP430F2617 rev H temperature sensor

$
0
0
Have not tried swapping the chips yet. Next on TODO list. I understand your concern about correct programming of ADC registers. Here is decoded register dump from the same unit/chip during temperature measurement: ADC12CTL1=0x250 not busy single channel, single conversion mclk as clock (16 MHz). Note: Vcc=3.3V, 16MHz is OK. clock / 3 = 5.3333 MHz sample input not inverted SAMPCON is from sampling timer ADC12SC is source for S&H conversion start address is 0 ADC12MCTL0=0x5a input channel is temperature diode reference: VR+ = VREF+ and VR- = VREF-/ VeREF- not end of sequence ADC12CTL0=0x7733 sw start active ADC12 enabled Conversion time overflow interrupt disabled Overflow interrupt disabled ADC12 on Reference on Reference is 1.5 V sampling timer requires a rising edge of the SHI signal to trigger SHT0x is 192 ADC12CLK cycles (36us) SHT1x is 192 ADC12CLK cycles (36us) ADC12MEM0=2999 T=35 C, 2999 And here is the source code. Not sure how to preserve src formatting with copy/paste. Above register dump is from printfs added in the code below: uint16_t adcSingle(uint16_t ch, int16_t ref) { uint16_t ctl0,ctl1; debug("adcSingle(%u,%d)\n",ch,ref); ctl0 = ADC12CTL0; /* save cfg */ ctl1 = ADC12CTL1; /* save cfg */ /* Must go into single mode before clearing ENC bit */ ADC12CTL1 = SHS_ADC12SC | /* SC bit starts conversion */ SHP | /* use ADC's sampling timer */ ADC12SSEL_MCLK | /* MCLK clock src */ ((ADC_DIV-1)<<5) | /* ADC clock = clock src / N */ CONSEQ_SINGLE; /* single channel / single conversion */ while(ADC12CTL1 & ADC12BUSY); /* wait for conversion to complete */ if(DebugLevel) printf("ADC12CTL1=0x%x\n",ADC12CTL1); ADC12CTL0 &= ~ENC; /* disable conversion */ ADC12CTL0 = ADC12ON | /* power up the core */ SHT0_DIV(ADC_SAMPLE_SLOW) | /* S&H 0 time */ SHT1_DIV(ADC_SAMPLE_SLOW) | /* S&H 1 time */ REFON; if(ref & REF25) /* update REF2_5V bit */ ADC12CTL0 |= REF2_5V; /* ref = 2.5V */ if((ctl0 ^ ADC12CTL0) & REF2_5V) /* new reference value */ sleep_ms(VREF_SETTLING_TIME); /* reference settling */ ADC12MCTL0 = ref | ch; /* configure conversion memory */ if(DebugLevel) printf("ADC12MCTL0=0x%x\n",ADC12MCTL0); ADC12CTL0 |= ADC12SC | ENC; /* start conversion */ if(DebugLevel) printf("ADC12CTL0=0x%x\n",ADC12CTL0); while(ADC12CTL1 & ADC12BUSY); /* wait for conversion to complete */ if(DebugLevel) printf("ADC12MEM0=%u\n",ADC12MEM0); return ADC12MEM0; } Regards, Sergei

Viewing all articles
Browse latest Browse all 63683

Trending Articles



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