7.1.1 FFD Project Creation with MAC Component

Developing the Application from Scratch using MCC

  1. Create a new MCC Harmony Project. For more details, refer to the Creating a New MCC Harmony Project from Related Links.
  2. From the Device Resources tab, navigate to Harmony>Wireless>Drivers>IEEE 802.15.4>IEEE 802.15.4 MAC.
  3. Click the plus symbol (+) to add the IEEE 802.15.4 MAC component (see the following figure).
    Figure 7-1. FFD Project - IEEE 802.15.4 MAC Component
    Note: The Device Resources tab displays IEEE 802.15.4 PHY and MAC components only if you clone the wireless_15_4_phy and wireless_15_4_mac repository in the MCC framework path.
  4. Upon selection, the user receives a prompt for auto-activation and auto-connect request of different component dependencies. Click Yes to add all the dependent components and also for all attachment auto-connect requests.
  5. Right click the TIME module for selecting the timer source.
    1. The user can select any of the timer source. For example, go to Available Satisfiers>TC0 (tc0).
    Figure 7-2. FFD Project - Timer Component
  6. Click the TIME Component. Open Configuration Options tab and perform the following steps:
    1. Change the “Number of Clients” 5 to 10 based on software timers.
      Figure 7-3. FFD Project - Number of Clients
  7. Click the IEEE 802.15.4 MAC component. Open Configuration Options tab and perform the following steps:
    1. In “Device Type Configuration” field, select FFD from the drop-down list for FFD project generation.
      Note: If security required, from “MAC Security Config” drop-down list, select Enabled.
      Figure 7-4. FFD Project - IEEE 802.15.4 MAC Device Type Configuration
  8. If console prints is required, the user can add a “CONSOLE” component to facilitate application console prints.
    1. In the Device Resources tab, navigate to Libraries>Harmony>System Services.
    2. Click the plus symbol (+) to add CONSOLE component (see the following figure).
      Figure 7-5. Adding CONSOLE Component
    3. In the project graph, right click on UART. Navigate to UART>Satisfiers>SERCOM0 to add and connect the SERCOM0 component.
      Figure 7-6. SERCOM0 Console Component
    4. Click on the SERCOM0 component. Open Configuration Options tab and perform the following steps:
      1. Change “TX Ring Buffer Size” and “RX Ring Buffer Size”.
      2. Change “Receive Pinout” and “Transmit Pinout”.
      Figure 7-7. SERCOM0 Configurations
    5. Configure the SERCOM0 to enable the direct high speed by performing the following steps:
      1. In “Project Graph” window, click the System component to open Configuration Options tab.
      2. To locate “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)”, navigate to System>Device & Project Configuration>PIC32WM_BZ6204 Device Configuration>Generate Fuse Settings>DEVCFG1
      3. From “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)” drop-down list, select DIRECT.
      Figure 7-8. System Configuration - SCOM0_HSEN Pin
  9. In the Device Resources tab, click the plus symbol (+) to add PIC32WM BZ6 Curiosity BSP.
    Figure 7-9. Device Resources - Board Support Packages
  10. The user can review the final project graph in the Project Graph window. The following figure illustrates the MAC project graph.
    Figure 7-10. MAC Project Graph (Full)
  11. Click Generate to generate code. The system adds the MAC files to the project upon code generation. For more details on code generation, refer to the MPLAB Code Configurator (MCC) Code Generation from Related Links.
    Figure 7-11. Code Generation
  12. After the completion of code generation, the system adds the header, source, and library files of MAC to the project under the config/IEEE_802154_MAC directory.
    Figure 7-12. Project Files
    Figure 7-13. MAC Source Files
  13. The system creates an RTOS task for the MAC layer.
  14. tasks.c file and WPAN_Init () will be called from SYS_Initialize() function. Change argument of SYS_Load_Cal () function WSS_ENABLE_NONE to WSS_ENABLE_ZB in initialization.c file.
    Figure 7-14. initialization.c

Adding Files To The Project

  1. Copy the demo_app_ffd application folder from the (wireless_apps_pic32_bz6/ apps/ieee_802_15_4 /MAC/ push_pull_mac_app/demoapp_ffd/firmware/src/) into created project folder (../firmware/src/) project repository.
    Figure 7-15. Project Repository
  2. Include the demoapp_ffd folder header files in project, as illustrated in the following figure.
    Figure 7-16. Header file
    Figure 7-17. Including Header Files
  3. After selecting the header files from the demoapp ffd folder in current project folder. Click Add.
    Figure 7-18. Add Files
  4. Do the same steps to add the source files to the project folder.
    Figure 7-19. Source Files
    Figure 7-20. Including Source Files
  5. After selecting the source files from the demoapp ffd folder in current project folder. Click Add.

  6. Once the files are included the project files will resemble as illustrated below.
    Figure 7-21. Project Files
  7. Open Configuration for adding include header files directories.
    Figure 7-22. Set Configuration
  8. In Project Properties,
    1. select XC32-gcc
    2. Select Preprocessing and messages in Option categories from the drop down
    3. Click Include directories
    Figure 7-23. Project Properties
  9. Browse and include demoapp ffd folder and click Apply and OK.
    Figure 7-24. Include Directories
    Figure 7-25. Including Files
  10. app.h file changes: add FFD Demo No beacon APP message ID’s.
    Figure 7-26. app.h

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