The MCR20A Wireless UART application functions as an wireless UART bridge between two (one-to-one) or several (one to many) boards. The application can be used with both a TERM, or with software that is capable of opening a serial port and writing to or reading from it. The characters sent or received are not necessarily ASCII printable characters.

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 15 06:08:30 2015 +0000
Revision:
16:549f2f246ece
Minor updates to compile also online

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cotigac 16:549f2f246ece 1 /*!
cotigac 16:549f2f246ece 2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
cotigac 16:549f2f246ece 3 * All rights reserved.
cotigac 16:549f2f246ece 4 *
cotigac 16:549f2f246ece 5 * \file PhyDebug.c
cotigac 16:549f2f246ece 6 * MCR20: PHY debug and logging functions
cotigac 16:549f2f246ece 7 *
cotigac 16:549f2f246ece 8 * Redistribution and use in source and binary forms, with or without modification,
cotigac 16:549f2f246ece 9 * are permitted provided that the following conditions are met:
cotigac 16:549f2f246ece 10 *
cotigac 16:549f2f246ece 11 * o Redistributions of source code must retain the above copyright notice, this list
cotigac 16:549f2f246ece 12 * of conditions and the following disclaimer.
cotigac 16:549f2f246ece 13 *
cotigac 16:549f2f246ece 14 * o Redistributions in binary form must reproduce the above copyright notice, this
cotigac 16:549f2f246ece 15 * list of conditions and the following disclaimer in the documentation and/or
cotigac 16:549f2f246ece 16 * other materials provided with the distribution.
cotigac 16:549f2f246ece 17 *
cotigac 16:549f2f246ece 18 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
cotigac 16:549f2f246ece 19 * contributors may be used to endorse or promote products derived from this
cotigac 16:549f2f246ece 20 * software without specific prior written permission.
cotigac 16:549f2f246ece 21 *
cotigac 16:549f2f246ece 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
cotigac 16:549f2f246ece 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
cotigac 16:549f2f246ece 24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cotigac 16:549f2f246ece 25 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
cotigac 16:549f2f246ece 26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
cotigac 16:549f2f246ece 27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
cotigac 16:549f2f246ece 28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
cotigac 16:549f2f246ece 29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
cotigac 16:549f2f246ece 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
cotigac 16:549f2f246ece 31 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cotigac 16:549f2f246ece 32 */
cotigac 16:549f2f246ece 33
cotigac 16:549f2f246ece 34
cotigac 16:549f2f246ece 35 /************************************************************************************
cotigac 16:549f2f246ece 36 *************************************************************************************
cotigac 16:549f2f246ece 37 * Includes
cotigac 16:549f2f246ece 38 *************************************************************************************
cotigac 16:549f2f246ece 39 ************************************************************************************/
cotigac 16:549f2f246ece 40
cotigac 16:549f2f246ece 41 #include "EmbeddedTypes.h"
cotigac 16:549f2f246ece 42 //#include "PortConfig.h"
cotigac 16:549f2f246ece 43 #include "MCR20Drv.h"
cotigac 16:549f2f246ece 44 #include "MCR20Reg.h"
cotigac 16:549f2f246ece 45 #include "Phy.h"
cotigac 16:549f2f246ece 46 #include "PhyDebug.h"
cotigac 16:549f2f246ece 47
cotigac 16:549f2f246ece 48
cotigac 16:549f2f246ece 49 #ifdef MAC_PHY_DEBUG
cotigac 16:549f2f246ece 50
cotigac 16:549f2f246ece 51
cotigac 16:549f2f246ece 52 /************************************************************************************
cotigac 16:549f2f246ece 53 *************************************************************************************
cotigac 16:549f2f246ece 54 * Private memory declarations
cotigac 16:549f2f246ece 55 *************************************************************************************
cotigac 16:549f2f246ece 56 ************************************************************************************/
cotigac 16:549f2f246ece 57
cotigac 16:549f2f246ece 58 uint16_t nDebugIndex = 0, nDebugSize = DEBUG_LOG_ENTRIES * 4;
cotigac 16:549f2f246ece 59 uint8_t nDebugStorage[DEBUG_LOG_ENTRIES * 4];
cotigac 16:549f2f246ece 60
cotigac 16:549f2f246ece 61
cotigac 16:549f2f246ece 62 /************************************************************************************
cotigac 16:549f2f246ece 63 *************************************************************************************
cotigac 16:549f2f246ece 64 * Public functions
cotigac 16:549f2f246ece 65 *************************************************************************************
cotigac 16:549f2f246ece 66 ************************************************************************************/
cotigac 16:549f2f246ece 67
cotigac 16:549f2f246ece 68 void PhyDebugLogTime(uint8_t item)
cotigac 16:549f2f246ece 69 {
cotigac 16:549f2f246ece 70 uint32_t time;
cotigac 16:549f2f246ece 71 nDebugStorage[nDebugIndex + 0] = item;
cotigac 16:549f2f246ece 72 MCR20Drv_DirectAccessSPIMultiByteRead( (uint8_t) EVENT_TMR_LSB, (uint8_t *) &time, 3);
cotigac 16:549f2f246ece 73
cotigac 16:549f2f246ece 74 nDebugStorage[nDebugIndex + 3] = (uint8_t) (time >> 0);
cotigac 16:549f2f246ece 75 nDebugStorage[nDebugIndex + 2] = (uint8_t) (time >> 8);
cotigac 16:549f2f246ece 76 nDebugStorage[nDebugIndex + 1] = (uint8_t) (time >> 16);
cotigac 16:549f2f246ece 77
cotigac 16:549f2f246ece 78 nDebugIndex += 4;
cotigac 16:549f2f246ece 79 if(nDebugIndex >= nDebugSize)
cotigac 16:549f2f246ece 80 {
cotigac 16:549f2f246ece 81 nDebugIndex = 0;
cotigac 16:549f2f246ece 82 }
cotigac 16:549f2f246ece 83 }
cotigac 16:549f2f246ece 84
cotigac 16:549f2f246ece 85 /***********************************************************************************/
cotigac 16:549f2f246ece 86
cotigac 16:549f2f246ece 87 void PhyDebugLogParam1(uint8_t item, uint8_t param1)
cotigac 16:549f2f246ece 88 {
cotigac 16:549f2f246ece 89 nDebugStorage[nDebugIndex + 0] = item;
cotigac 16:549f2f246ece 90 nDebugStorage[nDebugIndex + 1] = param1;
cotigac 16:549f2f246ece 91 nDebugStorage[nDebugIndex + 2] = 0;
cotigac 16:549f2f246ece 92 nDebugStorage[nDebugIndex + 3] = 0;
cotigac 16:549f2f246ece 93
cotigac 16:549f2f246ece 94 nDebugIndex += 4;
cotigac 16:549f2f246ece 95 if(nDebugIndex >= nDebugSize)
cotigac 16:549f2f246ece 96 {
cotigac 16:549f2f246ece 97 nDebugIndex = 0;
cotigac 16:549f2f246ece 98 }
cotigac 16:549f2f246ece 99 }
cotigac 16:549f2f246ece 100
cotigac 16:549f2f246ece 101 /***********************************************************************************/
cotigac 16:549f2f246ece 102
cotigac 16:549f2f246ece 103 void PhyDebugLogParam2(uint8_t item, uint8_t param1, uint8_t param2)
cotigac 16:549f2f246ece 104 {
cotigac 16:549f2f246ece 105 nDebugStorage[nDebugIndex + 0] = item;
cotigac 16:549f2f246ece 106 nDebugStorage[nDebugIndex + 1] = param1;
cotigac 16:549f2f246ece 107 nDebugStorage[nDebugIndex + 2] = param2;
cotigac 16:549f2f246ece 108 nDebugStorage[nDebugIndex + 3] = 0;
cotigac 16:549f2f246ece 109
cotigac 16:549f2f246ece 110 nDebugIndex += 4;
cotigac 16:549f2f246ece 111 if(nDebugIndex >= nDebugSize)
cotigac 16:549f2f246ece 112 {
cotigac 16:549f2f246ece 113 nDebugIndex = 0;
cotigac 16:549f2f246ece 114 }
cotigac 16:549f2f246ece 115 }
cotigac 16:549f2f246ece 116
cotigac 16:549f2f246ece 117 /***********************************************************************************/
cotigac 16:549f2f246ece 118
cotigac 16:549f2f246ece 119 void PhyDebugLogParam3(uint8_t item, uint8_t param1, uint8_t param2, uint8_t param3)
cotigac 16:549f2f246ece 120 {
cotigac 16:549f2f246ece 121 nDebugStorage[nDebugIndex + 0] = item;
cotigac 16:549f2f246ece 122 nDebugStorage[nDebugIndex + 1] = param1;
cotigac 16:549f2f246ece 123 nDebugStorage[nDebugIndex + 2] = param2;
cotigac 16:549f2f246ece 124 nDebugStorage[nDebugIndex + 3] = param3;
cotigac 16:549f2f246ece 125
cotigac 16:549f2f246ece 126 nDebugIndex += 4;
cotigac 16:549f2f246ece 127 if(nDebugIndex >= nDebugSize)
cotigac 16:549f2f246ece 128 {
cotigac 16:549f2f246ece 129 nDebugIndex = 0;
cotigac 16:549f2f246ece 130 }
cotigac 16:549f2f246ece 131 }
cotigac 16:549f2f246ece 132
cotigac 16:549f2f246ece 133 /***********************************************************************************/
cotigac 16:549f2f246ece 134
cotigac 16:549f2f246ece 135 #endif /* MAC_PHY_DEBUG */
cotigac 16:549f2f246ece 136
cotigac 16:549f2f246ece 137