7.4 Creating a New P2P PHY MCC Harmony Project
- To create a new project, perform
the following steps:
- Open MPLAB X IDE.
- Navigate to File>New Project.
Figure 7-1. New Project - In the New Project window, click on Microchip Embedded>Application
Project(s)>Next.
Figure 7-2. Choose Project - In Select Device tab,
perform the following steps:
- From the “device:” drop-down list, select WBZ351.
- Click Next to continue.
Figure 7-3. MCC Project Creation - In the Select Compiler
tab, perform the following steps:
- Under “XC32 [Download Latest]”, select the latest compiler.
- Click Next to continue.
Figure 7-4. Select Compiler - In the Select Project Name and Folder tab, perform the following
steps:
- In the “Project Name:” field, enter the project name.
- In the “Project Location” field, enter the project location.
- In the “Project Folder:” field, browse and select the project folder.
- Click Finish to continue.
Figure 7-5. Select Project Name and Folder - Now MPLAB X Code Configurator Content Manager automatically launches. It sets up
the configuration and initiates the project.
Figure 7-6. MCC Required Content - After a while, the MCC displays the project graph containing the default
components:
- CMSIS Pack
- System
- Device Family Pack (DFP)
- EVSYS
Figure 7-7. Project Graph - The following figure illustrates the Project Resources tab and
the Device Resources tab.
Figure 7-8. Project and Device Resources Tab
- After a while, the MCC displays the project graph containing the default
components:
- In the Device Resources
tab, perform the following steps:
- Navigate to Libraries>Harmony>Wireless>System Services.
- Locate “IEEE 802.15.4 PHY APP” component.
- Expand “IEEE 802.15.4 PHY APP” component, click the plus symbol (green)
next to IEEE 802.15.4 PHY APP to add the component to project
graph.
Figure 7-9. Adding IEEE 802.15.4 PHY APP Component - After adding the component, the MCC automatically prompts the user to accept any required dependencies or satisfiers.
- Click Yes to accept all dependencies. The MCC adds all necessary
modules and connections for the IEEE 802.15.4 PHY components to function
correctly.
Figure 7-10. Components Auto-Activation Confirmation - The following figure illustrates the MCC project graph and helps the
user verify the addition of all necessary components and properly
connect them.
Figure 7-11. Project Graph – Adding P2P PHY APP Component
- After the auto-population of all
the components, the user needs to manually select the following dependencies.
- The user must manually connect the CONSOLE component to its
consumer SYS_COMMAND.
Figure 7-12. Project Graph – COMMAND (sys_command) Component - The user must ensure to connect the CONSOLE component to it’s
dependency component SERCOM0 UART.Note: SERCOM 0 UART is specific to WBZ351 curiosity board, other SERCOMs can be selected as per the device selection.
Figure 7-13. SERCOM0 Component Selection - Dependencies like timer for IEEE 802.15.4 PHY component needs to be
added. (explained in API guide/user guide for the PHY component).
Figure 7-14. Timer Selection
- The user must manually connect the CONSOLE component to its
consumer SYS_COMMAND.
- The following image illustrates
the complete graph required for generating the application. Verify if the
Project Graph window includes all the expected MCC configurations.
Figure 7-15. Full Project Graph – P2P PHY APP Component - The following figure illustrates
the steps for configuring prior to project generation.
- In the Configurations
Options tab, perform the following steps:
- Expand “DEVCFG1”.
- From the “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)” drop-down list, select PPS.
Figure 7-16. System Configuration – P2P PHY APP (SCOM0_HSEN) - In the Configurations Options tab, perform the following steps:
- Expand “RTOS Configuration”.
- Under “Tick Mode” drop-down list, select Tick_Interrupt.
Figure 7-17. FreeRTOS Configuration – Tick Mode - SERCOM0 PAD configuration
and pin settings. The following figure illustrates the configuration of
the SERCOM0.
- Expand “SERCOM0”.
- From the “Receive Pinout” drop-down list, select SERCOM PAD[1] is used for data reception.
- From the “Transmit Pinout” drop-down list, select PAD[0] = TxD; PAD[2] = RTS; PAD[3] = CTS.
Figure 7-18. SERCOM0 Configuration – Receive/Transmit Pinout - For pin configuration, navigate to Plugins:>Pin
Configuration
Figure 7-19. Pin Configuration Note:- Flow Control: The P2P PHY application requires the user to enable RTS and CTS flow control. To enable SERCOM0 hardware flow control on the WBZ351 Curiosity Board using RTS and CTS, configure the TxD/RxD/RTS/CTS. For more details, see step 10c, SERCOM0 Configuration – Receive/Transmit Pinout figure. At the same time, ensure to set the “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)” of DEVCFG1 as PPS. For more details, see step 10a, System Configuration – P2P PHY APP (SCOM0_HSEN) figure.
- Hardware Modification: By default, the PB4 pin connects to the XPRO header. To use the UART_CTS pin, thee user must populate resistor (R3).
- The user can choose the
SYS_CONSOLE BUFFER configuration according to the
requirement.Tip: The recommendation is to have the maximum value possible.
- Expand “CONSOLE”.
- Set the “Console Print Buffer Size (128-8192)” value to 8,000.
Figure 7-20. Console Configuration – Console Print Buffer Size - To increase the stack size in “COMMAND” configuration, perform the
following steps:
- Expand “RTOS settings”.
- Set the “Stack Size (in bytes)” value to 2,048.
Figure 7-21. RTOS Settings – Stack Size - P2P PHY APP
component configuration options (the user can modify according
to the requirement).
Figure 7-22. P2P PHY APP Configuration
- In the Configurations
Options tab, perform the following steps:
- Click on the Generate
button available under MCC to generate the code.
Figure 7-23. MCC Project code Generation - MCC automatically generates files
and routines.
Figure 7-24. MCC Project code Generation - After generating the code
from MCC tool by clicking Generate, below is the project folder
structure.
Figure 7-25. MCC Project Code Generation - The following code snippet shows modifications that the user needs to
add in MCC generated files (lines to be modified are highlighted).
- Open the
tasks.cfile. - Add the following modifications in the
tasks.cfile in the places highlighted in the following figures.TaskHandle_t xSYS_CMD_Tasks;Figure 7-26. Application Edits Figure 7-27. Application Edits Note: The user must manually perform the above modifications for H3 repos using Core package version 3.12.1 or below. For the next release version of the core, these changes will be automatically generated. - Change argument
of
SYS_Load_Cal()function toWSS_ENABLE_ZBininitialization.cfile (This is mandatory for using the PHY library component).Figure 7-28. Application Edits
- Open the
- After generating the code
from MCC tool by clicking Generate, below is the project folder
structure.
- User Application Development
- Compile MCC auto
generated project as shown in following figure.
Figure 7-29. user edits - To address the mandatory
error in the
app_user_edits.cfile, the users need to take specific actions. The error message in the output window provides a direct link to the file where the issue is located. By following the steps outlined in theapp_user_edits.c, the users can make the necessary changes to resolve the error.Figure 7-30. USer Edits
- Compile MCC auto
generated project as shown in following figure.
- Build the project after doing all
the above changes and program on the WBZ351 Curiosity
Board.
Figure 7-31. Clean and Build MPLAB Project Figure 7-32. Program/Flash the Firmware to Device - P2P PHY application MCC
configurations: The Harmony3 based P2P PHY application framework allows users to
configure different settings and generate code based on those configurations.
- Application
Configuration: The user can configure application/PHY specific settings
like channel, source short address, IEEE® address,
and more here. The IEEE 802.15.4 PHY supports 16 channels (channel 11 to
26) in the 2.4 GHz frequency band. These configuration changes appear in
the
app_p2p_phy_config.hfile.
Figure 7-33. Application Configuration File - Application
Configuration: The user can configure application/PHY specific settings
like channel, source short address, IEEE® address,
and more here. The IEEE 802.15.4 PHY supports 16 channels (channel 11 to
26) in the 2.4 GHz frequency band. These configuration changes appear in
the
