LPC1769, ADC with NXP CMSIS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1769, ADC with NXP CMSIS

477 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by JojoS on Sun Mar 11 08:50:19 MST 2012
Hi,
I'm playing with the LPCXpresso and have used the webserver RTOSDemo_RDB1768. I have modified the sources to use the ADC with interrups.
Somehow it worked, but the converson rate did not match my setting in ADC_init(); I found there is a problem with setting a low sampling rate: then the divider becomes >255 and writes in other control bits than the estimated divider bits. The cmsis driver should check this, is there any address to report such problems?
I found also that there is a newer driver lib availible at NXP with improved clock setting. It takes into account that a conversion takes 65 clocks. But there was another little bug: the init function reads the cpu clock:
ADCPClk = CLKPWR_GetPCLK(CLKPWR_PCLKSEL_ADC);

In my case I used some (none cmsis) code to change the clock to 120 MHz, but the GetPCLK returned 100 MHz. After adding a ClockUpdate it worked fine:
 
SystemCoreClockUpdate();
 
 
ADCPClk = CLKPWR_GetPCLK(CLKPWR_PCLKSEL_ADC);

Maybe it is better to include the clock update function in the GetPCLK() to make sure to use the correct clock? I guess there are other places in the code where this can lead to wrong clock settings.

And another question: I found the updated CMSIS driver lib at NXP, but now I replaced only the adc code. I was not successful to create a new project in the Code Red IDE that creates a whole new CMSIS 2.0+drivers lib. Can anyone describe the necessary steps to create this project? In the NXP download are no project files for the CR environment.
0 Kudos
Reply
0 Replies