Bug in NXP cgu driver affecting UART
Submitted by sampullman on
Forums:
I couldn't get UART working from the NXP drivers included in the example code, so after some debugging I noticed that the CGU_GetPCLKFrequency function defined in lpc18xx_cgu.c was returning 0. I found a solution here:
http://www.lpcware.com/content/forum/keil-v460-and-lpc18xx-libraries
In case the forum isn't available later, the fix is to replace 2 defines in lpc18xx_cgu.c (on and after line 176).
#define CGU_REG_BRANCH_STATUS(x) (*(volatile uint32_t*)(CGU_CGU_ADDR+CGU_PERIPHERAL_Info[x].RegBranchOffset+4))
#define CGU_PER_BRANCH_STATUS(x) (*(volatile uint32_t*)(CGU_CGU_ADDR+CGU_PERIPHERAL_Info[x].PerBranchOffset+4))
I hope this saves somebody some frustration.