Library for controlling the WNC 14A2A from the K64F Freedom Board. It fulfills platform specific pure virtual methods from the WncControllerLibrary.

Dependencies:   WncControllerLibrary

Dependents:   WNC14A2AInterface

Fork of WncControllerK64F by Fred Kellerman

Use this interface to connect to and interact with the WNC M14A2A LTE Cellular Data Module which is provided by Wistron NeWeb Corporation (WNC) when using ARMmbed v5. The interface provides a Networking interface that can be used with the AT&T Cellular IoT Starter Kit that is sold by Avnet (http://cloudconnectkits.org/product/att-cellular-iot-starter-kit).

To demonstrate the use of the Interface, a series of example programs have been provided. Links to these examples are provided below. All examples can be compiled using both the on-line compiler and the ARMmbed CLI (command line interface, see https://github.com/ARMmbed/mbed-cli)

NOTE: This library/class is specific to the AT&T Cellular IoT Starter Kit which uses a FRDM-K64F. The users mbed.org compiler should be configured to use the FRDM-K64F platform.

Example Programs

Import the example programs below and follow the README.md in each to run the example program.

  • several examples of the interface using easy_connect.
  • SMS demonstration program that demonstrates SMS usage
  • Sockets demonstration program demonstrating using TCP sockets to interact with others
  • As new example program are developed, this README will be updated

WNC FIRWARE VERSION

The WNCInterface class currently supports the following version(s):

  • MPSS: M14A2A_v11.21.162331 APSS: M14A2A_v11.27.162331

License

This library is released under the Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License and may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Committer:
fkellermavnet
Date:
Thu Nov 17 15:31:35 2016 +0000
Revision:
23:43a36c66c574
Parent:
13:ef379cdd57aa
Child:
29:76e8acbafc80
Removed direct usage of debug UART for debug.  Added check for debug uart NULL pointer.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
fkellermavnet 0:98d149685c95 1 /*
fkellermavnet 0:98d149685c95 2 Copyright (c) 2016 Fred Kellerman
fkellermavnet 0:98d149685c95 3
fkellermavnet 0:98d149685c95 4 Permission is hereby granted, free of charge, to any person obtaining a copy
fkellermavnet 0:98d149685c95 5 of this software and associated documentation files (the "Software"), to deal
fkellermavnet 0:98d149685c95 6 in the Software without restriction, including without limitation the rights
fkellermavnet 0:98d149685c95 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
fkellermavnet 0:98d149685c95 8 copies of the Software, and to permit persons to whom the Software is
fkellermavnet 0:98d149685c95 9 furnished to do so, subject to the following conditions:
fkellermavnet 0:98d149685c95 10
fkellermavnet 0:98d149685c95 11 The above copyright notice and this permission notice shall be included in
fkellermavnet 0:98d149685c95 12 all copies or substantial portions of the Software.
fkellermavnet 0:98d149685c95 13
fkellermavnet 0:98d149685c95 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
fkellermavnet 0:98d149685c95 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
fkellermavnet 0:98d149685c95 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
fkellermavnet 0:98d149685c95 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
fkellermavnet 0:98d149685c95 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
fkellermavnet 0:98d149685c95 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
fkellermavnet 0:98d149685c95 20 THE SOFTWARE.
fkellermavnet 0:98d149685c95 21
fkellermavnet 23:43a36c66c574 22 @file WncControllerK64F.h
fkellermavnet 23:43a36c66c574 23 @purpose Contains K64F and mbed specifics to control the WNC modem using the WncController base class.
fkellermavnet 0:98d149685c95 24 @version 1.0
fkellermavnet 0:98d149685c95 25 @date July 2016
fkellermavnet 0:98d149685c95 26 @author Fred Kellerman
fkellermavnet 0:98d149685c95 27 */
fkellermavnet 0:98d149685c95 28
fkellermavnet 0:98d149685c95 29 #ifndef __WNCCONTROLLERK64F_H_
fkellermavnet 0:98d149685c95 30 #define __WNCCONTROLLERK64F_H_
fkellermavnet 0:98d149685c95 31
fkellermavnet 0:98d149685c95 32 #include <string>
fkellermavnet 0:98d149685c95 33 #include <stdint.h>
fkellermavnet 0:98d149685c95 34 #include "mbed.h"
fkellermavnet 0:98d149685c95 35 #include "MODSERIAL.h"
fkellermavnet 0:98d149685c95 36 #include "WncController.h"
fkellermavnet 0:98d149685c95 37
fkellermavnet 0:98d149685c95 38 namespace WncControllerK64F_fk {
fkellermavnet 0:98d149685c95 39
fkellermavnet 0:98d149685c95 40 using namespace WncController_fk;
fkellermavnet 0:98d149685c95 41 using namespace std;
fkellermavnet 0:98d149685c95 42
fkellermavnet 23:43a36c66c574 43 /** List of K64F pins that are used to control and setup the ATT IoT Kit WNC Shield */
fkellermavnet 0:98d149685c95 44 struct WncGpioPinListK64F {
fkellermavnet 0:98d149685c95 45 /////////////////////////////////////////////////////
fkellermavnet 0:98d149685c95 46 // NXP GPIO Pins that are used to initialize the WNC Shield
fkellermavnet 0:98d149685c95 47 /////////////////////////////////////////////////////
fkellermavnet 0:98d149685c95 48 DigitalOut * mdm_uart2_rx_boot_mode_sel; // on powerup, 0 = boot mode, 1 = normal boot
fkellermavnet 0:98d149685c95 49 DigitalOut * mdm_power_on; // 0 = turn modem on, 1 = turn modem off (should be held high for >5 seconds to cycle modem)
fkellermavnet 0:98d149685c95 50 DigitalOut * mdm_wakeup_in; // 0 = let modem sleep, 1 = keep modem awake -- Note: pulled high on shield
fkellermavnet 0:98d149685c95 51 DigitalOut * mdm_reset; // active high
fkellermavnet 0:98d149685c95 52 DigitalOut * shield_3v3_1v8_sig_trans_ena; // 0 = disabled (all signals high impedence, 1 = translation active
fkellermavnet 0:98d149685c95 53 DigitalOut * mdm_uart1_cts;
fkellermavnet 0:98d149685c95 54 };
fkellermavnet 0:98d149685c95 55
fkellermavnet 23:43a36c66c574 56
fkellermavnet 23:43a36c66c574 57 /**
fkellermavnet 23:43a36c66c574 58 * @author Fred Kellerman
fkellermavnet 23:43a36c66c574 59 * @see API
fkellermavnet 23:43a36c66c574 60 *
fkellermavnet 23:43a36c66c574 61 * <b>WncControllerK64F</b> This mbed C++ class is for controlling the WNC
fkellermavnet 23:43a36c66c574 62 * Cellular modem from the NXP K64F Freedom board. It uses the control code
fkellermavnet 23:43a36c66c574 63 * from it's base class WncController to handle the WNC Modem AT cmds. This
fkellermavnet 23:43a36c66c574 64 * class fulfills various pure virtual methods of the base class. The point of
fkellermavnet 23:43a36c66c574 65 * this class is to have the platform specific code in it thus isolating the
fkellermavnet 23:43a36c66c574 66 * control code logic from any particular platform or OS.
fkellermavnet 23:43a36c66c574 67 */
fkellermavnet 0:98d149685c95 68 class WncControllerK64F : public WncController
fkellermavnet 0:98d149685c95 69 {
fkellermavnet 0:98d149685c95 70 public:
fkellermavnet 23:43a36c66c574 71
fkellermavnet 0:98d149685c95 72 /**
fkellermavnet 0:98d149685c95 73 *
fkellermavnet 23:43a36c66c574 74 * Sets up the resources to control the WNC modem shield.
fkellermavnet 23:43a36c66c574 75 * @ingroup API
fkellermavnet 23:43a36c66c574 76 * @param pPins - pointer to a list of K64F pins that are used to setup and control the ATT IoT Kit's WNC Shield.
fkellermavnet 23:43a36c66c574 77 * @param wnc_uart - a pointer to the serial uart that is used to communicate with the WNC modem.
fkellermavnet 23:43a36c66c574 78 * @param debug_uart - a pointer to a serial uart for the debug output to go out of, if NULL debug will not be output.
fkellermavnet 0:98d149685c95 79 */
fkellermavnet 0:98d149685c95 80 WncControllerK64F(struct WncGpioPinListK64F * pPins, MODSERIAL * wnc_uart, MODSERIAL * debug_uart = NULL);
fkellermavnet 0:98d149685c95 81
fkellermavnet 0:98d149685c95 82 /**
fkellermavnet 0:98d149685c95 83 *
fkellermavnet 23:43a36c66c574 84 * Activates a mode where the user can send text to and from the K64F
fkellermavnet 0:98d149685c95 85 * debug Serial port directly to the WNC. The mode is entered via this
fkellermavnet 0:98d149685c95 86 * call. The mode is exited when the user types CTRL-Q. While in this
fkellermavnet 0:98d149685c95 87 * mode all text to and from the WNC is consumed by the debug Serial port.
fkellermavnet 0:98d149685c95 88 * No other methods in the class will receive any of the WNC output.
fkellermavnet 23:43a36c66c574 89 * @ingroup API
fkellermavnet 23:43a36c66c574 90 * @param pUart - a pointer to a uart to use to collect the user input and put the output from the WNC.
fkellermavnet 23:43a36c66c574 91 * @param echoOn - set to true to echo what is input back to the output of pUart.
fkellermavnet 0:98d149685c95 92 */
fkellermavnet 13:ef379cdd57aa 93 bool enterWncTerminalMode(MODSERIAL *pUart, bool echoOn);
fkellermavnet 0:98d149685c95 94
fkellermavnet 0:98d149685c95 95 private:
fkellermavnet 0:98d149685c95 96
fkellermavnet 0:98d149685c95 97 // Disallow copy
fkellermavnet 23:43a36c66c574 98 WncControllerK64F operator=(WncControllerK64F lhs);
fkellermavnet 0:98d149685c95 99
fkellermavnet 0:98d149685c95 100 // Users must define these functionalities:
fkellermavnet 0:98d149685c95 101 virtual int putc(char c);
fkellermavnet 0:98d149685c95 102 virtual int puts(const char * s);
fkellermavnet 0:98d149685c95 103 virtual char getc(void);
fkellermavnet 0:98d149685c95 104 virtual int charReady(void);
fkellermavnet 0:98d149685c95 105 virtual int dbgWriteChar(char b);
fkellermavnet 0:98d149685c95 106 virtual int dbgWriteChars(const char *b);
fkellermavnet 0:98d149685c95 107 virtual bool initWncModem(uint8_t powerUpTimeoutSecs);
fkellermavnet 0:98d149685c95 108 virtual void waitMs(int t);
fkellermavnet 0:98d149685c95 109 virtual void waitUs(int t);
fkellermavnet 0:98d149685c95 110
fkellermavnet 0:98d149685c95 111 virtual int getLogTimerTicks(void);
fkellermavnet 0:98d149685c95 112 virtual void startTimerA(void);
fkellermavnet 0:98d149685c95 113 virtual void stopTimerA(void);
fkellermavnet 0:98d149685c95 114 virtual int getTimerTicksA_mS(void);
fkellermavnet 0:98d149685c95 115 virtual void startTimerB(void);
fkellermavnet 0:98d149685c95 116 virtual void stopTimerB(void);
fkellermavnet 0:98d149685c95 117 virtual int getTimerTicksB_mS(void);
fkellermavnet 0:98d149685c95 118
fkellermavnet 0:98d149685c95 119 MODSERIAL * m_pDbgUart;
fkellermavnet 0:98d149685c95 120 MODSERIAL * m_pWncUart;
fkellermavnet 0:98d149685c95 121 WncGpioPinListK64F m_gpioPinList;
fkellermavnet 0:98d149685c95 122 Timer m_logTimer;
fkellermavnet 0:98d149685c95 123 Timer m_timerA;
fkellermavnet 0:98d149685c95 124 Timer m_timerB;
fkellermavnet 0:98d149685c95 125 };
fkellermavnet 0:98d149685c95 126
fkellermavnet 0:98d149685c95 127 }; // End namespace WncController_fk
fkellermavnet 0:98d149685c95 128
fkellermavnet 0:98d149685c95 129 #endif