7.1.1 FFD Project Creation with MAC Component
Developing the Application from Scratch using MCC
-
Create a new MCC Harmony Project. For more details, refer to Creating a New MCC Harmony Project
- From the “Device Resources”
field, go to Harmony>Wireless>Drivers>IEEE 802.15.4>IEEE 802.15.4
MACNote: IEEE 802.15.4 PHY and MAC components will appear in Device Resources only if, “wireless_15_4_phy” and “wireless_15_4_mac” repository is cloned in MCC framework path.
- Click on the plus symbol on the IEEE 802.15.4 MAC component, as illustrated in the above image.
-
Upon selection, user will receive a prompt for auto-activation and auto-connect request of different component dependencies. Select Yes to add all the dependent components and also for all attachment auto-connect requests.
-
Right click the TIME module for selecting the timer source, and select any one of the timer.
- Click the TIME Component, open Configuration Options and,
- Change the Number of Clients 5 to 10 based on software timers.
- Click the IEEE 802.15.4 MAC component, and open Configuration Options
and
- In “Device Type Configuration” field, select FFD from the drop
down for FFD project generationNote: If security required, select MAC Security config as Enabled.
- In “Device Type Configuration” field, select FFD from the drop
down for FFD project generation
-
If console prints is required, user can add a “CONSOLE” component to facilitate application console prints.
- Go to “Device Resources” field, and navigate to Libraries>Harmony>System Services and select CONSOLE
- In the project graph, right click on ◇ UART>Satisfiers>SERCOM0 to add and connect the SERCOM0 component.
- Click on the SERCOM0, open Configuration Options and, to change “Receive Pinout”, “Transmit Pinout” and “TX and RX Ring buffer” size as illustrated in the following figure.
- Perform the following
to configure the “SERCOM0” to enable the Direct High Speed.
- In Project Graph, click the System component to open Configuration Options.
- To locate “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)”, navigate to System>Device & Project Configuration>WBZ451 Device Configuration>Generate Fuse Settings>DEVCFG1
- Select DIRECT from the drop-down list as illustrated in the following figure.
-
Click 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. For more details on code generation, refer to Generate Code section.
-
Once the generation is completed, the header, source, and library files of MAC will be added to the project under config/IEEE_802154_MAC directory.
-
RTOS task for MAC Layer will be created.
-
tasks.c
file andWPAN_Init ()
will be called fromSYS_Initialize()
function. Change argument ofSYS_Load_Cal ()
functionWSS_ENABLE_NONE
toWSS_ENABLE_ZB
ininitialization.c
file.
Adding Files To The Project
-
Copy the
demo_app_ffd
application folder from Project repository (wireless_apps_pic32cxbz2_wbz45/ apps/ieee_802_15_4 /MAC/ push_pull_mac_app/demoapp_ffd/firmware/src/) into created project folder (../firmware/src/) - Include the demoapp_ffd folder header files in project, as illustrated in the following figure.
- After selecting the header files from the demoapp ffd folder in current project folder, Click Add.
- Do the same steps to add the source files to the project folder.
-
After selecting the source files from the demoapp ffd folder in current project folder, Click Add.
- Once the files are included the project files will resemble as illustrated below
- Open Configuration for adding include header files directories.
-
In Project Properties,
- select XC32-gcc
- Select Preprocessing and messages in Option categories from the drop down
- Click Include directories
- Browse and include demoapp ffd folder and click Apply and OK.
- app.h file changes: add FFD Demo No beacon APP message ID’s.
app.c file changes :
app_idle_task.c change:
For channel configuration (example:CHANNEL_OFFSET :3 , Channel => 11 + 3 = 14)
Right click on the project and Click on Clean and Build