Errors in "periph_adc" example for LPC11U68

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

Errors in "periph_adc" example for LPC11U68

911 Views
mjuggles
Contributor II

Using theLPCXpresso11U68 Evaluation Board, the "periph_adc" example has a warning and an invalid configuration.

The code is from: lpcopen_3_01_lpcxpresso_lpcxpresso_11e68

The warning is in Chip_ADC_StartCalibration() because the variable save_ADC_CTRL  is set but not used.  Removing the declaration and assignment resolves the warning.

The invalid configuration is in the IOCON setup:

 /* ADC input 8 is on PIO0_12 mapped to FUNC2 */
 Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 12, (IOCON_FUNC3 | IOCON_MODE_INACT | IOCON_ADMODE_EN));

The code sets the pin to Function 3 which is for the CT32B1 peripheral.  The comment is correct, Function 2 is for ADC_8.  Oddly enough, the ADC actually works with both Function 2 and 3, but Function 2 is specified in the User's Manual Rev. 1.8.

Tags (1)
0 Kudos
Reply
2 Replies

739 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Mark Johnson,

   Thanks a lot for your patience.

   I have got the reply from our according department, it is the lpcopen code bug, it should be IOCON_FUNC2 instead of IOCON_FUNC3. This bug has been report.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

739 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi Mark Johnson,

   Thank you for your feedback.

  1. Chip_ADC_StartCalibration warining

void Chip_ADC_StartCalibration(LPC_ADC_T *pADC)
{
    uint32_t save_ADC_CTRL;
    
    save_ADC_CTRL = pADC->CTRL;
    Chip_ADC_SetClockRate(LPC_ADC, ADC_CALIBRATE_RATE);
    
    pADC->CTRL = (pADC->CTRL | ADC_CR_CALMODEBIT) & ~ADC_CR_LPWRMODEBIT;
}

Yes, the save_ADC_CTRL is really not used in the code, the following code use pADC->CTRL directly, but it doesn't matter, it won't influence the code function.

2. PIO0_12 mapped problem.

  I have checked it on my side, you are right, it is really wrong, it should be IOCON_FUNC2 instead of IOCON_FUNC3.

  I already report this problem to our according department, any reply will let you know.

Thanks for your report.


Have a great day,
Kerry

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply