Has anyone used the 10 bit ADC at higher sampling frequencies? Would like to know if the response is linear at higher frequencies.
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.
Has anyone used the 10 bit ADC at higher sampling frequencies? Would like to know if the response is linear at higher frequencies.
Hi Kunal,
It seems that the linearity of the value sampled by the ADC is not very related to the sampling frequency.
Maybe you can do some test in 10 bit ADC mode.
Best Regards
Johnson
It seems some users of esp32 have pointed out that it doesn't pick up high audio frequencies faithfully. Just wanted to know cause I'll be using the msp430 for audio sampling around 80ksps
Hi Kunal,
I will test the linearity of the value sampled when this module run in 80kps and go back update.
Best Regards
Johnson
Hi kunal,
I do some test and post some data from my side as your reference :
Test environment :
VREF : 3.3V
ADC : 10bit
speed : 80kps
Voltage | 0.6 | 0.7 | 0.8 | 0.9 | 1 | 1.1 | 1.2 | 1.3 | 1.4 | 1.5 | 1.6 | 1.7 | 1.8 | 1.9 | 2 | 2.1 | 2.2 | 2.3 | 2.4 | 2.5 | 2.6 | 2.7 | 2.8 | 2.9 | 3 |
ADC Value | 186 | 215 | 249 | 277 | 309 | 344 | 373 | 405 | 435 | 465 | 500 | 529 | 561 | 592 | 619 | 651 | 684 | 716 | 745 | 779 | 809 | 840 | 869 | 901 | 935 |
The test date show the linearity of the value is well, I do not found any problem.
Best Regards
Johnson
There are my test code as your reference :
#include <msp430.h> void Software_Trim(); // Software Trim to get the best DCOFTRIM value #define MCLK_FREQ_MHZ 8 // MCLK = 8MHz unsigned int adc_value = 0; int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop WDT // Configure GPIO P1DIR |= BIT0; // Set P1.0 to output direction P1OUT &= ~BIT0; // Clear P1.0 // Configure ADC A1 pin SYSCFG2 |= ADCPCTL1; // Configure XT1 oscillator P2SEL0 |= BIT0 | BIT1; // P2.0~P2.1: crystal pins // Disable the GPIO power-on default high-impedance mode to activate // previously configured port settings PM5CTL0 &= ~LOCKLPM5; __bis_SR_register(SCG0); // disable FLL CSCTL3 |= SELREF__REFOCLK; // Set REFO as FLL reference source CSCTL1 = DCOFTRIMEN | DCOFTRIM0 | DCOFTRIM1 | DCORSEL_3;// DCOFTRIM=3, DCO Range = 8MHz CSCTL2 = FLLD_0 + 243; // DCODIV = 8MHz __delay_cycles(3); __bic_SR_register(SCG0); // enable FLL Software_Trim(); // Software Trim to get the best DCOFTRIM value CSCTL4 = SELMS__DCOCLKDIV | SELA__REFOCLK; // set default REFO(~32768Hz) as ACLK source, ACLK = 32768Hz // default DCODIV as MCLK and SMCLK source // Configure ADC ADCCTL0 |= ADCON | ADCMSC; // ADCON ADCCTL1 |= ADCSHS_2 | ADCCONSEQ_2; // repeat single channel; TA1.1 trig sample start ADCCTL2 |= ADCRES; // 10-bit conversion results ADCMCTL0 |= ADCINCH_1 | ADCSREF_0; // A1 ADC input select; Vref=1.5V ADCIE |= ADCIE0; // Enable ADC conv complete interrupt // Configure reference PMMCTL0_H = PMMPW_H; // Unlock the PMM registers PMMCTL2 |= INTREFEN; // Enable internal reference __delay_cycles(400); // Delay for reference settling ADCCTL0 |= ADCENC; // ADC Enable // ADC conversion trigger signal - TimerA1.1 (80KHz ON-period) TA1CCR0 = 100-1; // PWM Period TA1CCR1 = 50-1; // TA1.1 ADC trigger TA1CCTL1 = OUTMOD_4; // TA1CCR0 toggle TA1CTL = TASSEL__SMCLK | MC_1 | TACLR; // ACLK, up mode __bis_SR_register(LPM0_bits | GIE); // Enter LPM3 w/ interrupts } // ADC interrupt service routine #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=ADC_VECTOR __interrupt void ADC_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(ADC_VECTOR))) ADC_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(ADCIV,ADCIV_ADCIFG)) { case ADCIV_NONE: break; case ADCIV_ADCOVIFG: break; case ADCIV_ADCTOVIFG: break; case ADCIV_ADCHIIFG: break; case ADCIV_ADCLOIFG: break; case ADCIV_ADCINIFG: break; case ADCIV_ADCIFG: adc_value = ADCMEM0; // if (ADCMEM0 < 0x155) // ADCMEM = A0 < 0.5V? // P1OUT &= ~BIT0; // Clear P1.0 LED off // else // P1OUT |= BIT0; // Set P1.0 LED on ADCIFG = 0; break; // Clear CPUOFF bit from 0(SR) default: break; } } void Software_Trim() { unsigned int oldDcoTap = 0xffff; unsigned int newDcoTap = 0xffff; unsigned int newDcoDelta = 0xffff; unsigned int bestDcoDelta = 0xffff; unsigned int csCtl0Copy = 0; unsigned int csCtl1Copy = 0; unsigned int csCtl0Read = 0; unsigned int csCtl1Read = 0; unsigned int dcoFreqTrim = 3; unsigned char endLoop = 0; do { CSCTL0 = 0x100; // DCO Tap = 256 do { CSCTL7 &= ~DCOFFG; // Clear DCO fault flag }while (CSCTL7 & DCOFFG); // Test DCO fault flag __delay_cycles((unsigned int)3000 * MCLK_FREQ_MHZ);// Wait FLL lock status (FLLUNLOCK) to be stable // Suggest to wait 24 cycles of divided FLL reference clock while((CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)) && ((CSCTL7 & DCOFFG) == 0)); csCtl0Read = CSCTL0; // Read CSCTL0 csCtl1Read = CSCTL1; // Read CSCTL1 oldDcoTap = newDcoTap; // Record DCOTAP value of last time newDcoTap = csCtl0Read & 0x01ff; // Get DCOTAP value of this time dcoFreqTrim = (csCtl1Read & 0x0070)>>4;// Get DCOFTRIM value if(newDcoTap < 256) // DCOTAP < 256 { newDcoDelta = 256 - newDcoTap; // Delta value between DCPTAP and 256 if((oldDcoTap != 0xffff) && (oldDcoTap >= 256)) // DCOTAP cross 256 endLoop = 1; // Stop while loop else { dcoFreqTrim--; CSCTL1 = (csCtl1Read & (~(DCOFTRIM0+DCOFTRIM1+DCOFTRIM2))) | (dcoFreqTrim<<4); } } else // DCOTAP >= 256 { newDcoDelta = newDcoTap - 256; // Delta value between DCPTAP and 256 if(oldDcoTap < 256) // DCOTAP cross 256 endLoop = 1; // Stop while loop else { dcoFreqTrim++; CSCTL1 = (csCtl1Read & (~(DCOFTRIM0+DCOFTRIM1+DCOFTRIM2))) | (dcoFreqTrim<<4); } } if(newDcoDelta < bestDcoDelta) // Record DCOTAP closest to 256 { csCtl0Copy = csCtl0Read; csCtl1Copy = csCtl1Read; bestDcoDelta = newDcoDelta; } }while(endLoop == 0); // Poll until endLoop == 1 CSCTL0 = csCtl0Copy; // Reload locked DCOTAP CSCTL1 = csCtl1Copy; // Reload locked DCOFTRIM while(CSCTL7 & (FLLUNLOCK0 | FLLUNLOCK1)); // Poll until FLL is locked }
Best Regards
Johnson
**Attention** This is a public forum