MAX32620HSP (MAXREFDES100) RPC Example for Graphical User Interface

Dependencies:   USBDevice

Fork of HSP_Release by Jerry Bradshaw

This is an example program for the MAX32620HSP (MAXREFDES100 Health Sensor Platform). It demonstrates all the features of the platform and works with a companion graphical user interface (GUI) to help evaluate/configure/monitor the board. Go to the MAXREFDES100 product page and click on "design resources" to download the companion software. The GUI connects to the board through an RPC interface on a virtual serial port over the USB interface.

The RPC interface provides access to all the features of the board and is available to interface with other development environments such Matlab. This firmware provides realtime data streaming through the RPC interface over USB, and also provides the ability to log the data to flash for untethered battery operation. The data logging settings are configured through the GUI, and the GUI also provides the interface to download logged data.

Details on the RPC interface can be found here: HSP RPC Interface Documentation

Windows

With this program loaded, the MAX32620HSP will appear on your computer as a serial port. On Mac and Linux, this will happen by default. For Windows, you need to install a driver: HSP serial port windows driver

For more details about this platform and how to use it, see the MAXREFDES100 product page.

Committer:
jbradshaw
Date:
Tue Apr 25 10:47:10 2017 -0500
Revision:
3:8e9b9f5818aa
Parent:
0:e4a10ed6eb92
Removed Bulk Erasing, instead a small number of bytes are sampled from each and every page to determine if sector is "dirty", if so sector is erased
Prevents device from sleeping when the firmware detects a series of binary flash page RPC transfers, this increases flash page transfers by %450
when 200mS elapse with the last flash page transfer, normal sleep behaviour is resumed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jbradshaw 0:e4a10ed6eb92 1 /*******************************************************************************
jbradshaw 0:e4a10ed6eb92 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
jbradshaw 0:e4a10ed6eb92 3 *
jbradshaw 0:e4a10ed6eb92 4 * Permission is hereby granted, free of charge, to any person obtaining a
jbradshaw 0:e4a10ed6eb92 5 * copy of this software and associated documentation files (the "Software"),
jbradshaw 0:e4a10ed6eb92 6 * to deal in the Software without restriction, including without limitation
jbradshaw 0:e4a10ed6eb92 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
jbradshaw 0:e4a10ed6eb92 8 * and/or sell copies of the Software, and to permit persons to whom the
jbradshaw 0:e4a10ed6eb92 9 * Software is furnished to do so, subject to the following conditions:
jbradshaw 0:e4a10ed6eb92 10 *
jbradshaw 0:e4a10ed6eb92 11 * The above copyright notice and this permission notice shall be included
jbradshaw 0:e4a10ed6eb92 12 * in all copies or substantial portions of the Software.
jbradshaw 0:e4a10ed6eb92 13 *
jbradshaw 0:e4a10ed6eb92 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
jbradshaw 0:e4a10ed6eb92 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
jbradshaw 0:e4a10ed6eb92 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
jbradshaw 0:e4a10ed6eb92 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
jbradshaw 0:e4a10ed6eb92 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
jbradshaw 0:e4a10ed6eb92 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
jbradshaw 0:e4a10ed6eb92 20 * OTHER DEALINGS IN THE SOFTWARE.
jbradshaw 0:e4a10ed6eb92 21 *
jbradshaw 0:e4a10ed6eb92 22 * Except as contained in this notice, the name of Maxim Integrated
jbradshaw 0:e4a10ed6eb92 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
jbradshaw 0:e4a10ed6eb92 24 * Products, Inc. Branding Policy.
jbradshaw 0:e4a10ed6eb92 25 *
jbradshaw 0:e4a10ed6eb92 26 * The mere transfer of this software does not imply any licenses
jbradshaw 0:e4a10ed6eb92 27 * of trade secrets, proprietary technology, copyrights, patents,
jbradshaw 0:e4a10ed6eb92 28 * trademarks, maskwork rights, or any other form of intellectual
jbradshaw 0:e4a10ed6eb92 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
jbradshaw 0:e4a10ed6eb92 30 * ownership rights.
jbradshaw 0:e4a10ed6eb92 31 *******************************************************************************
jbradshaw 0:e4a10ed6eb92 32 */
jbradshaw 0:e4a10ed6eb92 33 #ifndef _STRINGHELPER_H_
jbradshaw 0:e4a10ed6eb92 34 #define _STRINGHELPER_H_
jbradshaw 0:e4a10ed6eb92 35
jbradshaw 0:e4a10ed6eb92 36 #include "mbed.h"
jbradshaw 0:e4a10ed6eb92 37
jbradshaw 0:e4a10ed6eb92 38 /**
jbradshaw 0:e4a10ed6eb92 39 * @brief Process an array of hex alpha numeric strings representing arguments of
jbradshaw 0:e4a10ed6eb92 40 * type uint8
jbradshaw 0:e4a10ed6eb92 41 * @param args Array of strings to process
jbradshaw 0:e4a10ed6eb92 42 * @param argsUintPtr Pointer of uint8 to save converted arguments
jbradshaw 0:e4a10ed6eb92 43 * @param numberOf Number of strings to convert
jbradshaw 0:e4a10ed6eb92 44 */
jbradshaw 0:e4a10ed6eb92 45 void ProcessArgs(char args[32][32], uint8_t *argsUintPtr, int numberOf);
jbradshaw 0:e4a10ed6eb92 46 /**
jbradshaw 0:e4a10ed6eb92 47 * @brief Format a binary 8-bit array into a string
jbradshaw 0:e4a10ed6eb92 48 * @param uint8Ptr byte buffer to process
jbradshaw 0:e4a10ed6eb92 49 * @param numberOf number of bytes in the buffer
jbradshaw 0:e4a10ed6eb92 50 * @param reply an array of strings to place the converted array values into
jbradshaw 0:e4a10ed6eb92 51 */
jbradshaw 0:e4a10ed6eb92 52 void FormatReply(uint8_t *uint8Ptr, int numberOf, char reply[32][32]);
jbradshaw 0:e4a10ed6eb92 53 /**
jbradshaw 0:e4a10ed6eb92 54 * @brief Process an array of hex alpha numeric strings representing arguments of
jbradshaw 0:e4a10ed6eb92 55 * type uint32
jbradshaw 0:e4a10ed6eb92 56 * @param args Array of strings to process
jbradshaw 0:e4a10ed6eb92 57 * @param argsUintPtr Pointer of uint32 to save converted arguments
jbradshaw 0:e4a10ed6eb92 58 * @param numberOf Number of strings to convert
jbradshaw 0:e4a10ed6eb92 59 */
jbradshaw 0:e4a10ed6eb92 60 void ProcessArgs32(char args[32][32], uint32_t *argsUintPtr, int numberOf);
jbradshaw 0:e4a10ed6eb92 61 /**
jbradshaw 0:e4a10ed6eb92 62 * @brief Process an array of decimal numeric strings representing arguments of
jbradshaw 0:e4a10ed6eb92 63 * type uint32
jbradshaw 0:e4a10ed6eb92 64 * @param args Array of strings to process
jbradshaw 0:e4a10ed6eb92 65 * @param argsUintPtr Pointer of uint32 to save converted arguments
jbradshaw 0:e4a10ed6eb92 66 * @param numberOf Number of strings to convert
jbradshaw 0:e4a10ed6eb92 67 */
jbradshaw 0:e4a10ed6eb92 68 void ProcessArgs32Dec(char args[32][32], uint32_t *argsUintPtr, int numberOf);
jbradshaw 0:e4a10ed6eb92 69 /**
jbradshaw 0:e4a10ed6eb92 70 * @brief Format a binary 32-bit array into a string
jbradshaw 0:e4a10ed6eb92 71 * @param uint32Ptr 32-bit value buffer to process
jbradshaw 0:e4a10ed6eb92 72 * @param numberOf number of values in the buffer
jbradshaw 0:e4a10ed6eb92 73 * @param reply an array of strings to place the converted array values into
jbradshaw 0:e4a10ed6eb92 74 */
jbradshaw 0:e4a10ed6eb92 75 void FormatReply32(uint32_t *uint32Ptr, int numberOf, char reply[32][32]);
jbradshaw 0:e4a10ed6eb92 76 /**
jbradshaw 0:e4a10ed6eb92 77 * @brief Parse an incoming string hex value into an 8-bit value
jbradshaw 0:e4a10ed6eb92 78 * @param str string to process
jbradshaw 0:e4a10ed6eb92 79 * @returns 8-bit byte that is parsed from the string
jbradshaw 0:e4a10ed6eb92 80 */
jbradshaw 0:e4a10ed6eb92 81 uint8_t StringToByte(char str[32]);
jbradshaw 0:e4a10ed6eb92 82 /**
jbradshaw 0:e4a10ed6eb92 83 * @brief Parse an incoming string hex value into 32-bit value
jbradshaw 0:e4a10ed6eb92 84 * @param str string to process
jbradshaw 0:e4a10ed6eb92 85 * @returns 32-bit value that is parsed from the string
jbradshaw 0:e4a10ed6eb92 86 */
jbradshaw 0:e4a10ed6eb92 87 uint32_t StringToInt(char str[32]);
jbradshaw 0:e4a10ed6eb92 88 /**
jbradshaw 0:e4a10ed6eb92 89 * @brief Parse a single string in decimal format to a uint32 number
jbradshaw 0:e4a10ed6eb92 90 * @param str String to process
jbradshaw 0:e4a10ed6eb92 91 * @returns Returns the converted number of type uint32
jbradshaw 0:e4a10ed6eb92 92 */
jbradshaw 0:e4a10ed6eb92 93 uint32_t ParseAsciiDecU32(char *str);
jbradshaw 0:e4a10ed6eb92 94 /**
jbradshaw 0:e4a10ed6eb92 95 * @brief Parse a single string in hex format to a uint32 number
jbradshaw 0:e4a10ed6eb92 96 * @param str String to process
jbradshaw 0:e4a10ed6eb92 97 * @returns Returns the converted number of type uint32
jbradshaw 0:e4a10ed6eb92 98 */
jbradshaw 0:e4a10ed6eb92 99 uint32_t ParseAsciiHexU32(char *str);
jbradshaw 0:e4a10ed6eb92 100 /**
jbradshaw 0:e4a10ed6eb92 101 * @brief Format a binary 8-bit array into a string
jbradshaw 0:e4a10ed6eb92 102 * @param data 8-bit value buffer to process
jbradshaw 0:e4a10ed6eb92 103 * @param length number of values in the buffer
jbradshaw 0:e4a10ed6eb92 104 * @param str output string buffer
jbradshaw 0:e4a10ed6eb92 105 * @return output string
jbradshaw 0:e4a10ed6eb92 106 */
jbradshaw 0:e4a10ed6eb92 107 char *BytesToHexStr(uint8_t *data, uint32_t length, char *str);
jbradshaw 0:e4a10ed6eb92 108 /**
jbradshaw 0:e4a10ed6eb92 109 * @brief Parse an incoming string until a CRLF is encountered, dst will contain
jbradshaw 0:e4a10ed6eb92 110 * the parsed string
jbradshaw 0:e4a10ed6eb92 111 * @param src source string to process
jbradshaw 0:e4a10ed6eb92 112 * @param dst destination string to contain the parsed incoming string
jbradshaw 0:e4a10ed6eb92 113 * @param length length of incoming src string
jbradshaw 0:e4a10ed6eb92 114 * @returns updated pointer in src string
jbradshaw 0:e4a10ed6eb92 115 */
jbradshaw 0:e4a10ed6eb92 116 char *ParseUntilCRLF(char *src, char *dst, int length);
jbradshaw 0:e4a10ed6eb92 117
jbradshaw 0:e4a10ed6eb92 118 #endif // _STRINGHELPER_H_