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 Creating a New MCC Harmony Project

  2. From the “Device Resources” field, go to Harmony>Wireless>Drivers>IEEE 802.15.4>IEEE 802.15.4 MAC
    Figure 7-1. 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” and “wireless_15_4_mac” repository is cloned in MCC framework path.
  3. Click on the plus symbol on the IEEE 802.15.4 MAC component, as illustrated in the above image.
  4. 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.

  5. Right click the TIME module for selecting the timer source, and select any one of the timer.
    Figure 7-2. Timer Component
  6. Click the TIME Component, open Configuration Options and,
    1. Change the Number of Clients 5 to 10 based on software timers.
      Figure 7-3. TIME Configuration
  7. Click the IEEE 802.15.4 MAC component, and open Configuration Options and
    1. In “Device Type Configuration” field, select FFD from the drop down for FFD project generation
      Note: If security required, select MAC Security config as Enabled.
      Figure 7-4. IEEE 802.15.4 MAC Configuration
  8. If console prints is required, user can add a “CONSOLE” component to facilitate application console prints.
    1. Go to “Device Resources” field, and navigate to Libraries>Harmony>System Services and select CONSOLE
      Figure 7-5. CONSOLE Component
    2. In the project graph, right click on ◇ UART>Satisfiers>SERCOM0 to add and connect the SERCOM0 component.
      Figure 7-6. Console Component
    3. 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.
      Figure 7-7. SERCOM0 Configurations
    4. Perform the following to configure the “SERCOM0” to enable the Direct High Speed.
      1. In Project Graph, click the System component to open Configuration Options.
      2. To locate “SERCOM0 Direct (High Speed) Pin Enable (SCOM0_HSEN)”, navigate to System>Device & Project Configuration>WBZ451 Device Configuration>Generate Fuse Settings>DEVCFG1
      3. Select DIRECT from the drop-down list as illustrated in the following figure.
      Figure 7-8. System Configuration - SERCOM0
  9. Click PIC32CX BZ2 Curiosity BSP under Device Resources.
    Figure 7-9. Device Resources
  10. 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.

    Figure 7-10. Code Generation
  11. 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.
    Figure 7-11. Project Files
    Figure 7-12. MAC Source Files
  12. RTOS task for MAC Layer will be created.

  13. 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-13. initialization.c

Adding Files To The Project

  1. 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/)
    Figure 7-14. Project Repository
  2. Include the demoapp_ffd folder header files in project, as illustrated in the following figure.
    Figure 7-15. Header file
    Figure 7-16. Including Header Files
  3. After selecting the header files from the demoapp ffd folder in current project folder, Click Add.
    Figure 7-17. Add Files
  4. Do the same steps to add the source files to the project folder.
    Figure 7-18. Source Files
    Figure 7-19. 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-20. Project Files
  7. Open Configuration for adding include header files directories.
    Figure 7-21. 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-22. Project Properties
  9. Browse and include demoapp ffd folder and click Apply and OK.
    Figure 7-23. Include Directories
    Figure 7-24. Including Files
  10. app.h file changes: add FFD Demo No beacon APP message ID’s.
    Figure 7-25. 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