NXP / Mbed 2 deprecated mcr20_wireless_uart

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by Freescale

By default, the application uses broadcast addresses for OTA communication. This way, the application can be directly downloaded and run without any user intervention. The following use case assumes no changes have been done to the project.

  • Two (or more) MCR20A platforms (plugged into the FRDM-K64F Freescale Freedom Development platform) have to be connected to the PC using the mini/micro-USB cables.
  • The code must be downloaded on the platforms via CMSIS-DAP (or other means).
  • After that, two or more TERM applications must be opened, and the serial ports must be configured with the same baud rate as the one in the project (default baud rate is 115200). Other necessary serial configurations are 8 bit, no parity, and 1 stop bit.
  • To start the setup, each platform must be reset, and one of the (user) push buttons found on the MCR20A platform must be pressed. The user can press any of the non-reset buttons on the FRDM-K64F Freescale Freedom Development platform as well. *This initiates the state machine of the application so user can start.

Documentation

SMAC Demo Applications User Guide

Committer:
cotigac
Date:
Sun Mar 08 04:18:09 2015 +0000
Revision:
13:4fa8e504061f
Parent:
RF_Drivers_Freescale/driverRFPhy.c@12:4446d8228309
Temporary reverted back to Atmel RF Drivers

Who changed what in which revision?

UserRevisionLine numberNew contents of line
FSL\B36402 12:4446d8228309 1 /*!
FSL\B36402 12:4446d8228309 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
FSL\B36402 12:4446d8228309 3 * All rights reserved.
FSL\B36402 12:4446d8228309 4 *
FSL\B36402 12:4446d8228309 5 * \file MCR20Drv.c
FSL\B36402 12:4446d8228309 6 *
FSL\B36402 12:4446d8228309 7 * Redistribution and use in source and binary forms, with or without modification,
FSL\B36402 12:4446d8228309 8 * are permitted provided that the following conditions are met:
FSL\B36402 12:4446d8228309 9 *
FSL\B36402 12:4446d8228309 10 * o Redistributions of source code must retain the above copyright notice, this list
FSL\B36402 12:4446d8228309 11 * of conditions and the following disclaimer.
FSL\B36402 12:4446d8228309 12 *
FSL\B36402 12:4446d8228309 13 * o Redistributions in binary form must reproduce the above copyright notice, this
FSL\B36402 12:4446d8228309 14 * list of conditions and the following disclaimer in the documentation and/or
FSL\B36402 12:4446d8228309 15 * other materials provided with the distribution.
FSL\B36402 12:4446d8228309 16 *
FSL\B36402 12:4446d8228309 17 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
FSL\B36402 12:4446d8228309 18 * contributors may be used to endorse or promote products derived from this
FSL\B36402 12:4446d8228309 19 * software without specific prior written permission.
FSL\B36402 12:4446d8228309 20 *
FSL\B36402 12:4446d8228309 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
FSL\B36402 12:4446d8228309 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
FSL\B36402 12:4446d8228309 23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
FSL\B36402 12:4446d8228309 24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
FSL\B36402 12:4446d8228309 25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
FSL\B36402 12:4446d8228309 26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
FSL\B36402 12:4446d8228309 27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
FSL\B36402 12:4446d8228309 28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
FSL\B36402 12:4446d8228309 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
FSL\B36402 12:4446d8228309 30 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
FSL\B36402 12:4446d8228309 31 */
FSL\B36402 5:69f1634cd40b 32
FSL\B36402 5:69f1634cd40b 33
FSL\B36402 12:4446d8228309 34 /*****************************************************************************
FSL\B36402 12:4446d8228309 35 * INCLUDED HEADERS *
FSL\B36402 12:4446d8228309 36 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 37 * Add to this section all the headers that this module needs to include. *
FSL\B36402 12:4446d8228309 38 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 39 *****************************************************************************/
FSL\B36402 12:4446d8228309 40
FSL\B36402 12:4446d8228309 41
FSL\B36402 12:4446d8228309 42 #include "arm_hal_phy.h"
FSL\B36402 12:4446d8228309 43 #include "arm_hal_interrupt.h"
FSL\B36402 12:4446d8228309 44
FSL\B36402 5:69f1634cd40b 45
FSL\B36402 12:4446d8228309 46 /*****************************************************************************
FSL\B36402 12:4446d8228309 47 * PRIVATE VARIABLES *
FSL\B36402 12:4446d8228309 48 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 49 * Add to this section all the variables and constants that have local *
FSL\B36402 12:4446d8228309 50 * (file) scope. *
FSL\B36402 12:4446d8228309 51 * Each of this declarations shall be preceded by the 'static' keyword. *
FSL\B36402 12:4446d8228309 52 * These variables / constants cannot be accessed outside this module. *
FSL\B36402 12:4446d8228309 53 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 54 *****************************************************************************/
FSL\B36402 5:69f1634cd40b 55
FSL\B36402 12:4446d8228309 56 static uint8_t mac_eui64[8];
FSL\B36402 12:4446d8228309 57 static phy_device_driver_s device_driver;
FSL\B36402 12:4446d8228309 58 static int8_t rf_radio_driver_id = -1;
FSL\B36402 12:4446d8228309 59 static phy_device_channel_info_s channel_info;
FSL\B36402 12:4446d8228309 60
FSL\B36402 12:4446d8228309 61 /*****************************************************************************
FSL\B36402 12:4446d8228309 62 * PUBLIC VARIABLES *
FSL\B36402 12:4446d8228309 63 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 64 * Add to this section all the variables and constants that have global *
FSL\B36402 12:4446d8228309 65 * (project) scope. *
FSL\B36402 12:4446d8228309 66 * These variables / constants can be accessed outside this module. *
FSL\B36402 12:4446d8228309 67 * These variables / constants shall be preceded by the 'extern' keyword in *
FSL\B36402 12:4446d8228309 68 * the interface header. *
FSL\B36402 12:4446d8228309 69 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 70 *****************************************************************************/
FSL\B36402 5:69f1634cd40b 71
FSL\B36402 12:4446d8228309 72 /*****************************************************************************
FSL\B36402 12:4446d8228309 73 * PRIVATE FUNCTIONS PROTOTYPES *
FSL\B36402 12:4446d8228309 74 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 75 * Add to this section all the functions prototypes that have local (file) *
FSL\B36402 12:4446d8228309 76 * scope. *
FSL\B36402 12:4446d8228309 77 * These functions cannot be accessed outside this module. *
FSL\B36402 12:4446d8228309 78 * These declarations shall be preceded by the 'static' keyword. *
FSL\B36402 12:4446d8228309 79 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 80 *****************************************************************************/
FSL\B36402 5:69f1634cd40b 81
FSL\B36402 12:4446d8228309 82 /*****************************************************************************
FSL\B36402 12:4446d8228309 83 * PRIVATE FUNCTIONS *
FSL\B36402 12:4446d8228309 84 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 85 * Add to this section all the functions that have local (file) scope. *
FSL\B36402 12:4446d8228309 86 * These functions cannot be accessed outside this module. *
FSL\B36402 12:4446d8228309 87 * These definitions shall be preceded by the 'static' keyword. *
FSL\B36402 12:4446d8228309 88 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 89 *****************************************************************************/
FSL\B36402 12:4446d8228309 90
FSL\B36402 5:69f1634cd40b 91
FSL\B36402 12:4446d8228309 92 /*****************************************************************************
FSL\B36402 12:4446d8228309 93 * PUBLIC FUNCTIONS *
FSL\B36402 12:4446d8228309 94 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 95 * Add to this section all the functions that have global (project) scope. *
FSL\B36402 12:4446d8228309 96 * These functions can be accessed outside this module. *
FSL\B36402 12:4446d8228309 97 * These functions shall have their declarations (prototypes) within the *
FSL\B36402 12:4446d8228309 98 * interface header file and shall be preceded by the 'extern' keyword. *
FSL\B36402 12:4446d8228309 99 *---------------------------------------------------------------------------*
FSL\B36402 12:4446d8228309 100 *****************************************************************************/
FSL\B36402 12:4446d8228309 101
FSL\B36402 5:69f1634cd40b 102
FSL\B36402 5:69f1634cd40b 103 /*
FSL\B36402 5:69f1634cd40b 104 * \brief Function initialises and registers the RF driver.
FSL\B36402 5:69f1634cd40b 105 *
FSL\B36402 5:69f1634cd40b 106 * \param none
FSL\B36402 5:69f1634cd40b 107 *
FSL\B36402 5:69f1634cd40b 108 * \return rf_radio_driver_id Driver ID given by NET library
FSL\B36402 5:69f1634cd40b 109 */
FSL\B36402 5:69f1634cd40b 110 int8_t rf_device_register(void)
FSL\B36402 5:69f1634cd40b 111 {
FSL\B36402 5:69f1634cd40b 112 rf_init();
FSL\B36402 5:69f1634cd40b 113 /*Set pointer to MAC address*/
FSL\B36402 12:4446d8228309 114 device_driver.PHY_MAC = mac_eui64;
FSL\B36402 12:4446d8228309 115 device_driver.driver_description = "Freescale_MAC";
FSL\B36402 5:69f1634cd40b 116 #if PHY_LINK_15_4_2_4GHZ_TYPE
FSL\B36402 5:69f1634cd40b 117 /*Number of channels in PHY*/
FSL\B36402 5:69f1634cd40b 118 channel_info.channel_count = 16;
FSL\B36402 5:69f1634cd40b 119 /*Channel mask 26-11*/
FSL\B36402 5:69f1634cd40b 120 channel_info.channel_mask = 0x07FFF800;
FSL\B36402 5:69f1634cd40b 121 /*Type of RF PHY is SubGHz*/
FSL\B36402 5:69f1634cd40b 122 device_driver.link_type = PHY_LINK_15_4_2_4GHZ_TYPE;
FSL\B36402 5:69f1634cd40b 123 device_driver.link_channel_info = &channel_info;
FSL\B36402 5:69f1634cd40b 124 #else
FSL\B36402 5:69f1634cd40b 125 /*Number of channels in PHY*/
FSL\B36402 5:69f1634cd40b 126 channel_info.channel_count = 11;
FSL\B36402 5:69f1634cd40b 127 /*Channel mask 0-10*/
FSL\B36402 5:69f1634cd40b 128 channel_info.channel_mask = 0x000007ff;
FSL\B36402 5:69f1634cd40b 129 /*Type of RF PHY is SubGHz*/
FSL\B36402 5:69f1634cd40b 130 device_driver.link_type = PHY_LINK_15_4_SUBGHZ_TYPE;
FSL\B36402 5:69f1634cd40b 131 device_driver.link_channel_info = &channel_info;
FSL\B36402 5:69f1634cd40b 132 #endif
FSL\B36402 5:69f1634cd40b 133 /*Maximum size of payload is 127*/
FSL\B36402 5:69f1634cd40b 134 device_driver.phy_MTU = 127;
FSL\B36402 5:69f1634cd40b 135 /*No header in PHY*/
FSL\B36402 5:69f1634cd40b 136 device_driver.phy_header_length = 0;
FSL\B36402 5:69f1634cd40b 137 /*No tail in PHY*/
FSL\B36402 5:69f1634cd40b 138 device_driver.phy_tail_length = 0;
FSL\B36402 5:69f1634cd40b 139 /*Set address write function*/
FSL\B36402 5:69f1634cd40b 140 device_driver.phy_xx_address_write = &rf_address_write;
FSL\B36402 5:69f1634cd40b 141 /*Set RF extension function*/
FSL\B36402 5:69f1634cd40b 142 device_driver.phy_xx_extension = &rf_extension;
FSL\B36402 5:69f1634cd40b 143 /*Set RF state control function*/
FSL\B36402 5:69f1634cd40b 144 device_driver.phy_xx_state_control = &rf_interface_state_control;
FSL\B36402 5:69f1634cd40b 145 /*Set transmit function*/
FSL\B36402 5:69f1634cd40b 146 device_driver.phy_xx_tx = &rf_start_cca;
FSL\B36402 5:69f1634cd40b 147 printf("RF Device Registration...");
FSL\B36402 5:69f1634cd40b 148 /*Register device driver*/
FSL\B36402 5:69f1634cd40b 149 rf_radio_driver_id = arm_net_phy_register(&device_driver);
FSL\B36402 5:69f1634cd40b 150 printf("OK\r\n");
FSL\B36402 5:69f1634cd40b 151 return rf_radio_driver_id;
FSL\B36402 5:69f1634cd40b 152 }
FSL\B36402 5:69f1634cd40b 153