4.2 MCC Demo RFD Project creation with MAC component
Note: The MPLAB® Code Configurator steps needs to be done if the MCC is configured for the first time. Otherwise, MAC project can be created by following procedure
Select “New Project”
Select “32-bit MCC Harmony Project
Framework Selection existing MCC folder
Project Settings
Configuration Settings
Automatically it will open“MPLAB Code Configurator” after creation of the project.
MCC content manager window will appear in IDE. Select “MPLAB Harmony” from the content manager window.
If no required content click on finish.
After click on finish MCC window will appear as follows.
Once Project graph is getting displayed for the created project, Double click on the IEEE 802.15.4 MAC component.
Note: IEEE 802.15.4 PHY and MAC components will appear in Device Resources only if, wireless_15_4_phy_v1.0.0 and wireless_15_4_mac repo is cloned in MCC framework path
Upon selecting the component, the dependent modules are getting added to the project and Popup will come for getting the approval. Select “Yes” for all of them. MAC component depend on following H3 component,
- IEEE 802.15.4 PHY
- TRNG
Then PHY component depend on following H3 component,
- Device Support Library
- Core
- TRNG
- SYSTEM Time module
- (PHY Uses one client of SYS_TIME_MODULE) – So, the number of SYS_TIME_CLIENT should be more than 1.
The project graph will look like
Right Click on TIME module for selecting the timer source, Select any of the timer.
Click on Time Component => Go to Configuration Options => Change the Number of Clients 5 to 10 based on software timers (if less than 5 timers no need to change).
Device type selection (Choose RFD) for RFD project generation and If security required choose MAC Security Config as Enabled and click on yes on pop window as security dependency of wolfCrypt Library.
If choose RFD device type it will shows Enable Sleep option, so if sleep needed enable the Enable Sleep option.If Enabled sleep option, the dependent modules are getting added to the project and Popup will come for getting the approval. Select “Yes” for all of them.
Double click on Device Support in Project Graph tab(it will be highlighted) -> In Configuration Options tab -> Device Support -> Check the Enable PMU Mode Setting -> PMU Mode ->Select PMU_MODE_BUCK_PWM
Plugins -> double click on Clock Configuration
Follow the below images to configure the clocks
Click on CONSOLE under System Services.
Right clickon Console Driver => Go to Satisfiers => Click on SERCOM0(sercom0)
Click on SERCOM 0 => Go to configuration options => Change Receive pinout, Transmit pinout, TX and RX Ring buffer size as 256
Configure the SERCOM0 system setting to enable the Direct High Speed
Click On PIC32CX BZ2 Curiosity BSP under Device Resources.
Click on Generate Tab for Code generation. Upon code generation, MAC files will be added to the project.
RTOS task for MAC Layer will be created and WPAN_Init() will be called from SYS_Initialize() function. Change argument of SYS_Load_Cal () function to WSS_ENABLE_ZB in initialization.c file.
Copy the demo app rfd application files from following repo in MAC demo app RFD project folder (wireless_apps_pic32cxbz2_wbz45/apps/ieee_802_15_4/MAC/push_pull_mac_app/demoapp_rfd/firmware/src/) into created project folder (../firmware/src/) Repo URL: bitbucket.microchip.com/projects/MH3/repos/wireless_apps_pic32cxbz2_wbz45/browse Tag Name : v1.3.0
Include demoapp rfd folder as corresponding RFD project of Header files.
For including demoapp rfd header files in project
After select demoapp rfd folder, it will show as below image. And click on Add.
Include demoapp rfd folder as corresponding RFD project of Source files.
For including demoapp rfd source files in project
After select demoapp rfd folder, it will show as below image. And click on Add.
Added Demo no beacon app RFD Application files
Open Configuration for adding include header files directories.
Select XC32-gcc => Select Preprocessing and messages in option categories => Click on Include directories.
Browse and include demoapp rfd header files directories and click Apply and OK.
app.h file changes: add RFD APP message ID’s.
app.c file changes:
app_user_edits.c file changes: selected line should be commented.
app_idle_task.c change:
For channel configuration (example:CHANNEL_OFFSET :3 , Channel => 11 + 3 = 14)
If sleep enabled in RFD: add in selected line in app_idle_task.c. Device deep sleep in RFD demo is handled directly from APP task. So there is no need for calling vPortSuppressTicksAndSleep(). This is application specific change.
Right click on the project and Click on Clean and Build