LPC800 LPCOpen - bug in acmp_8xx.c Ladder Voltage Setup

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

LPC800 LPCOpen - bug in acmp_8xx.c Ladder Voltage Setup

218 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brownm on Sat Oct 26 22:28:34 MST 2013
Hi there

There is a bug in the LPCOpen driver for setting the Ladder Point.

The Ladder select is from bit 5:1 in the register but the original code is OR'ing the ladsel value at bit 0, It needs to move it one place to the left before the OR'ing occurs.

/* Sets up voltage ladder */
void Chip_ACMP_SetupVoltLadder(LPC_CMP_T *pACMP, uint32_t ladsel, bool ladrefVDDCMP)
{
uint32_t reg = pACMP->LAD & ~(ACMP_LADSEL_MASK | ACMP_LADREF_MASK);

//mkb added this line as the LAD sel is from 5:1 in the register so we need to shift the
//ladsel value << 1
ladsel = ladsel << 1;     //<-------------FIX THE BIT SHIFT. 

/* Setup voltage ladder and ladder reference */
if (ladrefVDDCMP) {
reg |= ACMP_LADREF_MASK;
}
pACMP->LAD = reg | ladsel;
}





Regards

Marshall Brown
Labels (1)
0 Kudos
1 Reply

201 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Mon Oct 28 10:28:40 MST 2013
Thanks for submitting this, this is a definite bug. I've created a bug tracker entry for this at:
http://www.lpcware.com/content/bugtrackerissue/lpc800-acmp-ladder-selection-value-misaligned

...and have updated the known issue list for the v2.01 LPC8xx release.
0 Kudos