Q1. The internal ADCs in ADSP-CM40x processors can be configured to select internally generated reference voltage or external reference voltage. How do I select this?
A>> By default ADC selects internal 2.5V reference.
It can be turned off and external reference can be selected during Analog Subsystem initialization. While initialising Analog Subsystem, we should program ADCC_CFG.REFSEL bit to select the internal reference or external reference. The Analog subsystem can be initiated by setting ADCC_CTL.ADCFG bit.
- e.g below code will select external reference.
void Init_AnalogSubsystem(void) { *pREG_ADCC0_TCA0 = (((1 << BITP_ADCC_TCA0_CKDIV ) & BITM_ADCC_TCA0_CKDIV ) | ((8 << BITP_ADCC_TCA0_NCK ) & BITM_ADCC_TCA0_NCK ) ); *pREG_ADCC0_TCB0 = (((1 << BITP_ADCC_TCB0_TCSCK ) & BITM_ADCC_TCB0_TCSCK ) | ((0 << BITP_ADCC_TCB0_TCKCS ) & BITM_ADCC_TCB0_TCKCS ) | ((11 << BITP_ADCC_TCB0_TCSCS ) & BITM_ADCC_TCB0_TCSCS ) ); *pREG_ADCC0_TCA1 = (((1 << BITP_ADCC_TCA1_CKDIV ) & BITM_ADCC_TCA1_CKDIV ) | ((8 << BITP_ADCC_TCA1_NCK ) & BITM_ADCC_TCA1_NCK ) ); *pREG_ADCC0_TCB1 = (((1 << BITP_ADCC_TCB0_TCSCK ) & BITM_ADCC_TCB0_TCSCK ) | ((0 << BITP_ADCC_TCB0_TCKCS ) & BITM_ADCC_TCB0_TCKCS ) | ((11 << BITP_ADCC_TCB0_TCSCS ) & BITM_ADCC_TCB0_TCSCS ) ); // Configure ADCC_CFG register *pREG_ADCC0_CFG = ((1 << BITP_ADCC_CFG_REFSEL ) & BITM_ADCC_CFG_REFSEL ); // Enable ADCC with // LSBF0, LSBF1, DSWP0, DSWP1, TIDLE0, TIDLE1, CSPOL0, CSPOL1, CKPOL0, CKPOL1 = 0 // TRGIE0, TRIGIE1 = 0. So, TRGSEL0, TRGSEL1, TRGPOL0, TRGPOL1, TRGOEN0, TRGOEN1 will xx // TMR1EN, DMAEN = 0. CSIZE = 0, DSIZE = 1, CFG = 1; *pREG_ADCC0_CTL = (BITM_ADCC_CTL_EN | BITM_ADCC_CTL_ADCFG | BITM_ADCC_CTL_DSIZE); // wait till ADC configuration is pending while(!(*pREG_ADCC0_CFG & BITM_ADCC_CFG_PND)); // wait for PND bit to set and then wait till it clears while( *pREG_ADCC0_CFG & BITM_ADCC_CFG_PND) ; // wait till ADCC operation is pending // Disable ADCC *pREG_ADCC0_CTL = 0x0000; // disable ADCC first while(*pREG_ADCC0_CFG & BITM_ADCC_CFG_PND); // wait till ADCC operation is pending }
When external reference is selected, we have to give external voltage of 2.5V to the VREF0 and VREF1 pins of processor. On ADSP-CM408F EZ-KIT, this can be provided from U6 and U7 ADR441ARMZ chips by installing JP1 and JP4 jumpers.