1. Please read the build section of Libraries and Example before building anything
2. Never give batch build with all the items selected.
3. When building an example make sure the M0 image is built and ready before building the M4 image
4. Read the latest release notes before proceeding with this document
This document will provide the instructions and information required to use the LPC43xx dual core demos. The source files can be either obtained from the git server or can be downloaded from the http://lpcware.com/content/nxpfile/lpc43xx-dual-core-examples as a compressed zip file.
2.1 Dual Core in LPC43XX
The LPC43xx is an ARM M4/M0 based dual core microcontroller. The SoC comes with Internal IRAM/Flash of various sizes. Please read the LPC43xx user manual and the board user manual carefully before starting to use the dual core demos on any of the LPC43XX board.
2.2 Hardware requirements
· Keil MCB4300 Development board
· Serial cable or USB to serial port dongle
· Keil uLink-2 or Keil uLink-Pro or Segger J-Link debugger (for ARM Cortex M devices)
· Development PC/Laptop (Host Machine)
2.3 Software requirements
· Keil uVision IDE MDK-ARM tool-chain (version 4.54 or above)
· Terminal emulation software (Teraterm recommended)
· Windows OS in which Keil tool can run (Windows 7 recommended)
The software has two main directories, the “library” directory and the “applications” directory. It follows the same directory structure as followed by the “NXPUSBLibrary”. Inside the “applications” directory is the main Keil multi project workspace LPC43xx_Demo_Examples.uvmpw could be found as shown in Figure 1: Directory structure of LPC43xx Dual Core Demo Examples. The library directory has the following libraries in it
· CDL (for LPC43XX)
· BSP (for KEIL MCB4357 board)
· nxpUSBLib (for Host and Device)
The example directory will have both the nxpUSBlib, and the MultiCore examples. This document will only have the details about the MultiCore examples. The Following MultiCore examples can be found under examples directory.
· Common (Not an example in itself but is used by all the examples)
· USB_KBD_Host (USB Host Stack with Keyboard class driver and Blinky)
· USB_MS_Device (USB Mass Storage device and Blinky)
4.1 Building Library
Open the Keil uVision multiple project workspace by double clicking on the “LPC43xx_Demo_Examples.uvmpw”. The project workspace opens in the uVision IDE, as shown in Figure 2: LPC43xx_Demo_Example in Keil uVision Workspace.
For building the libraries it is recommended to use the batch build option provided by Keil. Select “Project” from the menu (on top of the IDE), followed by “Batch build…”, which will open the batch build window as shown in Figure 3: Batch build dialog. To build a specific library all the other selections must be cleared, this can be done by clicking on “Deselect All” button located in the left side of the dialog. Now to build, say CDL library, the appropriate library configurations must be selected [Example, for CDL “LPC43xx_M4 and LPC43xx_M0” must be selected]. Clicking the build button located at the top left side of the dialog will build the selected library. Each project is provided with a README.TXT file that will help the user to know more about the various configurations and how to use them.
The library can also be built configuration by configuration. To do so, one must first make that project active by right clicking on the library and selecting the “Set as Active Project” from the menu that pops up (marked red in Figure 4: Setting active Project and Configuration), now select a configuration from the pull down menu (marked as green in Figure 4: Setting active Project and Configuration). Once the active configuration is selected press “F7” key to start the build process of the active configuration. After successful build select the next configuration and start the build process.
4.2 CDL (Common Driver Library)
The common driver library (CDL) will have the functions with which can be used to initialize and operate on any peripheral present in the SoC. It has files that implements functions for each peripheral (lpc43xx_uart, lpc43xx_i2c etc,). The CDL also has the CMSIS sources which will have the startup code required for starting up of the SoC. The CMSIS library has 2 startup files (lpc43xx_startup.S and lpc43xx_startup_m0.S) for Cortex M4 core and Cortex M0 core respectively.
The CDL supports two configurations (LPC43xx_M4 and LPC43xx_M0) one for each core
This configuration will build the library that could be linked and used with application that is meant to run on M0 core. This library will have the startup code for M0 core. If the users want to develop a new module they must keep in mind that all the IRQ handler names are prefixed with “M0_”.
This configuration will build CDL library, so that it can be linked and used by applications that are compiled for M4 core.
4.2.3 Output Files
All output files (including the object and list files) will be located under “keil_ouput” directory of the corresponding library/example
CDL_LPC43xx_M4.lib – Generated by building CDL for “LPC43xx_M4” configuration
CDL_LPC43xx_M4.lib – Generated by building CDL for “LPC43xx_M0” configuration
4.3 BSP (Board Support Package) Library
This library has the functions required to initialize the board specific features. For example the external Flash, external DRAM, pin mux, LEDs etc. This library implements the bsp_init API that initializes the board (Recommended to call only from M4 core). This library supports two boards HITEX LPC4350 and KEIL MCB4357. The user must build the configurations only for the relevant board. Say, for example the users of HITEX 4350 board must build only HITEX4350_M0 and HITEX4350_M4, and should not build anything else. The board configuration that was build last (M0 and M4) will be considered for linking with any application.
For batch building of this library it is recommended to build only two configurations (M0, M4) that belongs to the same board.
This configuration will build the BSP library for MCB4300 board and will provide functions that can be called from M0 core. This configuration must be built only along with MCB4300_M4 and not with any other configuration.
This configuration will build the BSP library for MCB4300 board and will provide functions that can be called from M4 core. This configuration must be built only along with MCB4300_M0 and not with any other configuration.
4.3.3 Output Files
BSP_LPC43XX_M4.lib – Library generated by building MCB4300_M4 configuration
BSP_LPC43XX_M0.lib – Library generated by building MCB4300_M0 configuration
Since we do not generate separate libraries for each board the configuration build recently will be taken for linking with the example applications.
4.4 nxpUSBlib (NXP’s USB Library)
This library provides the USB host/device support for LPC USB based microcontrollers. The original source of this library can be found at www.lpcware.com. But it is recommended to use the sources provided along with the dual core examples (Has some bug fixes and routines required for dual core operation of this library). For more information refer to document that comes along with the library.
For batch building this library it is recommended to select all the configurations.
LPC43xx_Host_M0 – Configuration that builds USB host stack for M0 core
LPC43xx_Device_M0 – Configuration that builds USB device stack for M0 core
LPC43xx_Host_M4 – Configuration that builds USB host stack for M4 core
LPC43xx_Device_M4 – Configuration that builds USB device stack for M4 core
4.4.3 Output Files
nxpUSBlib_LPC43xx_Host_M0.lib – Created by building this library for configuration LPC43xx_Host_M0
nxpUSBlib_LPC43xx_Device_M0.lib – Created by building this library for configuration LPC43xx_Device_M0
nxpUSBlib_LPC43xx_Host_M4.lib – Created by building this library for configuration LPC43xx_Host_M4
nxpUSBlib_LPC43xx_Device_M4.lib – Created by building this library for configuration LPC43xx_Device_M4
This library is compiled of the FreeRTOS source obtained from www.freertos.org. Minimal modifications had been made to the OS files so that they will work on LPC43xx in both the cores. For more information about FreeRTOS refer www.freeRTOS.org
For batch building it is recommended to select all the configurations.
This configuration will compile FreeRTOS library from the sources that could be run from M0 core of LPC43xx. When this configuration is selected the FreeRTOS source will read its configuration header from lpc43xx_m0_FreeRTOSConfig.h kept under config directory of the FreeRTOS library, and will use RITIMER hardware to generate the system ticks.
This configuration will compile FreeRTOS library from the sources that could be run from M4 core of LPC43xx. When this configuration is selected the FreeRTOS source will read its configuration header from lpc43xx_m4_FreeRTOSConfig.h kept under config directory of the FreeRTOS library.
188.8.131.52 Output Files
FreeRTOS_LPC43XX_M0.lib – Generated by building the library using LPC43xx_M0 configuration.
FreeRTOS_LPC43XX_M4.lib – Generated by building the library using LPC43xx_M4 configuration.
4.6 IPComm (Inter Processor Communication Library)
This library provides the functions to communicate between cores (M0/M4). This is required for the applications running on both the cores. For more information about this library and usage refer Application Note AN11177: Inter Processor Communications.
It is recommended to select all the configuration during the batch build.
Standalone_M0 – Building IPC library for this configuration will generate IPC functions without support from any OS and can run on M0 core
Standalone_M4 – Building IPC library for this configuration will generate IPC functions without support from any OS and can run on M4 core
FreeRTOS_M0 – Building IPC library for this configuration will generate IPC functions with FreeRTOS support and can run on M0 core
FreeRTOS_M4 – Building IPC library for this configuration will generate IPC functions with FreeRTOS support and can run on M4 core
4.6.3 Output Files
The following are the output files generated for the above configurations respectively
5.1 Setting up of board and debuggers
This section provides information about setting up of various board to execute the dual core examples. For now the examples support only HITEX4350 and MCB4300 boards.
5.1.1 Setting up MCB4300 board
Follow the steps below to setup the KEIL MCB4300 board to run the dual core examples
1. Connect the U-Link/J-Link debugger’s 10-Pin debug port header to J6 port of the board.
2. Connect the debugger to the Host PC using USB cable provided with the debugger (Debugger’s power LED should be lit after connecting)
3. Connect a Serial cable (Straight cable) to the board’s P11 (UART0/3) port and connect the other end to the host PC
4. Open teraterm select the COM port corresponding to the Serial Port to which the board is connected, select 115200 as the baud rate and no flow control
5. Connect the USB cable’s (Type-A to Micro-B) Micro-B end to the board’s Micro-B receptacle P2 (USB0) [Not to P4 USB1]
6. Connect the Type-A end of the USB cable to the host PC (now the board should power ON)
5.1.2 Setting up Examples for debugging
The following steps must be executed for all the examples. It must only be carried out for M4 targets and need not have to be done for any M0 target. It is applicable only for the examples and not for the libraries.
1. Select the example as active project by right clicking on it (Circled red in Figure 4: Setting active Project and Configuration)
2. Select the M4 configuration from the configuration selection pull down menu (Circled green in Figure 4: Setting active Project and Configuration)
3. In the project view (Located in the left side of the IDE), expand the active example by clicking on it and click on the configuration (shown with a folder icon)
4. Press “Alt” key and while holding it Press and release “F7” key, this will show the options dialog for the currently selected M4 configuration
6. Now configure your debugger as shown in the figure (Red circles in Figure 5: Debugger configuration in Keil uVision)5. Click on the “Debug” tab located on the top of the dialog (Blue circle in Figure 5: Debugger configuration in Keil uVision)
7. Click on the Settings button (Green circle in Figure 5: Debugger configuration in Keil uVision) to open the debugger hardware configuration dialog as shown in Figure 7: U-Link debugger Hardware settings
8. Setup the configuration (shown in red circles) in the dialog as shown in Figure 6: U-Link debugger Hardware settings
9. Click OK to save the configuration and close the dialog
10. Now click on the utilities tab at the top of the options dialog (Tab next to the blue circled debug tab in Figure 5: Debugger configuration in Keil uVision)
11. Now the window will look as shown in Figure 7: Keil flash configuration utility window
12. Setup the configuration (red circled) in the utility window as shown in Figure 7: Keil flash configuration utility window
13. Click the settings button (Green circled in Figure 7: Keil flash configuration utility window)
14. That will open the Flash driver setup window as shown in Figure 8
15. Select the configuration (Red circled) as shown in
16. Click on the add button (Green Circled in Figure 8: Flash driver configuration window)
17. That will open the flash programming algorithm select window as in Figure 9: Flash Programming Algorighm select window
18. In the flash programming algorithm window select SST39VF3201x and click “Add” button in Figure 9: Flash Programming Algorighm select window
19. Repeat Step 16 to 18 for LPC18xx/43xx IAP 512kB for both 1A000000 and 1B000000 address range
20. Click OK (Blue circled) as shown in Figure 8: Flash driver configuration window
21. Press OK in Keil flash configuration utility window to save the configuration and exit the options window
22. Repeat the steps for all the examples for all the M4 configurations
5.1.3 Building & Executing Examples
Every example will have a set of M0 configuration and M4 configurations, the user must build the M0 configuration first and then the corresponding M4 configuration. For compatible configurations please refer to the configuration table provided under each example. Once both M0 and the corresponding M4 images are built click on the debug button to start the debugging. Press “F5” key to execute the code.
5.2 Blinky Example
This example blinks the LED1 (Red LED in HITEX board) and LED2 (Green LED in HITEX board). The M4 core pushes the LED1 turn ON/OFF message at an interval of every 500 milliseconds and the message is popped by M0 core and based on the message it turn ON/OFF LED1. The same way M0 core pushes LED2 ON/OFF message and is popped by the M4 core and blinks the LED2 accordingly. So, on both the cores there will be two tasks running one pushes the message another pops and executes the command present in the message.
All configurations possible
All configurations possible
Table 5‑1: Blinky Example configuration
5.2.3 Expected Output
LED1 and LED2 blinks at different rates.
5.3 USB Host Stack Example (with Keyboard class driver)
This example runs the USB Host stack in any of the core with the keyboard class driver. The stack running in any core will receive the keystroke and will push it to the other core via message queue. The other core will receive the message and print the key pressed to UART. It then sends an acknowledgement message to theblinky task running along with the USB host stack to toggle an LED.
Table 5‑3: USB Keyboard demo configurations
5.3.2 Expected Output
Blinks LED1 and LED2, connecting the keyboard to the host port will print the message keyboard enumerated on the COM port. Any key pressed in the keyboard will be printed on the teraterm. Key press will also toggle LED3.
5.4 USB Device Stack Example (Mass Storage Device Class)
This example will run the USB device stack (Mass storage class) in any core while running the Blinky on both the cores. This example also has the FAT file system parser for getting the data present in the file storage area.
Same as USB Keyboard demo configurations
5.4.3 Expected Output
The Host PC will enumerate the board as a USB disk and will contain a README.TXT that carries the text “USB Device demonstration”. LED1 and LED2 will be blinked by the Blinky tasks. The Mass Storage task will toggle the LED3 for every SCSI command it receives.