Step 3: Generate Harmony Code

Last modified by Microchip on 2024/01/26 19:06

Expand the source file folders in the Projects pane. Notice that these are the files from Lab 2 that you copied to this directory.

Project files

Back to Top

Click on the Generate Code button as shown in the following figure. Notice the Merging Strategy option.

Generate code

Back to Top

Note the new USB folders added to the lab.

New USB folders

Back to Top

Check for MPLAB® Harmony v3 issues in previously released versions.

In previously released versions of the MPLAB Harmony v3 USB code (USB 3.3.0 and earlier), some issues needed to be resolved in usb_device_init_data.c. The directory structure below shows the location of this file, which MPLAB Harmony Configurator (MHC) generates.

USB_device_init_data location

In the usb_device_init_data.c source file, set the size of flashRowBackupBuffer (line 71) to "2048".

Buffer size

Also, In the source file usb_device_init_data.c make sure the function names are changed to "AsyncWrite" (line 110) and "EventHandlerSet" (line 112).

function name changes

If you do need to modify these lines, the next time you generate code, you will see the following merge screen displayed. Just press the Close button.

Merge close button

Back to Top

Save all files and build the code. To do this, click on the Clean and Build icon rebuild-project icon and verify the project builds successfully.

At this point, you should be able to debug and step through the application. Effectively, you have a running MPLAB Harmony system. However, it is not yet ready to do anything. Next, you will develop your application state machine logic and make sure the system does what you want it to do. You’re ready to start implementing the application now.

Back to Top