Microcontroller Initialization

We will use SystemInit() and CGU_Init() function to initialize the LPC4300 microcontroller and its Clock Generation Unit (CGU) respectively. These functions are defined in system_LPC43xx.c and lpc43xx_cgu.c files, so let's add them to our project. 

Use Add Files dialog box (menu [Project | Add Files...]) to add the files from the following locations:  

  • lpc43xx\Core\Device\NXP\LPC43xx\Source\Templates\system_LPC43xx.c
  • lpc43xx\Core\Device\NXP\LPC43xx\Include\system_LPC43xx.h 
  • lpc43xx\Drivers\source\lpc43xx_cgu.c
  • lpc43xx\Drivers\include\lpc43xx_cgu.h 
  • lpc43xx\Drivers\source\lpc43xx_scu.c 
  • lpc43xx\Drivers\include\lpc43xx_scu.h 

​The last two files contains the scu_pinmux() function, which is called from CGU_Init().

​Now our project should contain 8 files:

IAR project files

Let's open our main.c file and add the following code:

#include "LPC43xx.h"
#include "lpc43xx_cgu.h"
#include "system_LPC43xx.h" 

int main()

  return 0;