I am very new to LPC43xx series processors. My problem is with reading ADC using a specific channel.
After going thorough the user guide and examples provided, I have come up with following steps.
/* get scu base */
p = (LPC_SCU_Type*)(LPC_SCU_BASE);
/*
* Select ADC function
*/
p->ENAIO1 |= 0x80; //Enable ADC function for ADC1_7 (pad PF_7 in BGA256 package)
/*
* Disable internal pullup
* Disable internal pull down
* Select function as GPIO
*/
p->SFSPF_7 = 0x14; // Is this configuration is correct??
/* Set GPIO as input mode */
GPIO_SetDir(GPIO_PORT_7,(1<< 21), INPUT_MODE);
/* disable band gap option */
p->ENAIO2 = 0;
/* ADC initialize */
ADC_Init(LPC_ADC1, 200000, 10); /* Initialize ADC1 */
/* Disable ADC Interrupt *
ADC_IntConfig(LPC_ADC1,ADC_ADINTEN7,DISABLE);
ADC_ChannelCmd(LPC_ADC1,ADC_CHANNEL_7,ENABLE);
ADC_StartCmd(LPC_ADC1,ADC_START_NOW);
/*
* Wait for conversion to complete
*/
while (!(ADC_ChannelGetStatus(LPC_ADC1,ADC_CHANNEL_7,ADC_DATA_DONE)));
ADC_val = ADC_ChannelGetData(LPC_ADC0,ADC_CHANNEL_7);
}
I have measured the pad PF_2 which is having voltage of 1.56, but I always get 0 in adc register.
Verified that DONE bit is getting set after the adc conversion start.
Do I missed any initialization.
Appreciate any pointers on this issue...