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 Oct 25 15:22:11 2016 +0000
Revision:
0:e4a10ed6eb92
Child:
1:9490836294ea
tewt

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 S25FS512_H_
jbradshaw 0:e4a10ed6eb92 34 #define S25FS512_H_
jbradshaw 0:e4a10ed6eb92 35
jbradshaw 0:e4a10ed6eb92 36 #include "mbed.h"
jbradshaw 0:e4a10ed6eb92 37 #include "QuadSpiInterface.h"
jbradshaw 0:e4a10ed6eb92 38
jbradshaw 0:e4a10ed6eb92 39 class S25FS512 {
jbradshaw 0:e4a10ed6eb92 40 public:
jbradshaw 0:e4a10ed6eb92 41 S25FS512(QuadSpiInterface *_quadSpiInterface);
jbradshaw 0:e4a10ed6eb92 42 ~S25FS512(void);
jbradshaw 0:e4a10ed6eb92 43
jbradshaw 0:e4a10ed6eb92 44 QuadSpiInterface *quadSpiInterface;
jbradshaw 0:e4a10ed6eb92 45
jbradshaw 0:e4a10ed6eb92 46 /** Initialize the driver
jbradshaw 0:e4a10ed6eb92 47 */
jbradshaw 0:e4a10ed6eb92 48 int init(void);
jbradshaw 0:e4a10ed6eb92 49
jbradshaw 0:e4a10ed6eb92 50 /** Detect the presence of the flash device
jbradshaw 0:e4a10ed6eb92 51 */
jbradshaw 0:e4a10ed6eb92 52 uint8_t detect(void);
jbradshaw 0:e4a10ed6eb92 53
jbradshaw 0:e4a10ed6eb92 54 /** Read the identification of the flash
jbradshaw 0:e4a10ed6eb92 55 */
jbradshaw 0:e4a10ed6eb92 56 int8_t readIdentification(uint8_t *dataArray, uint8_t length);
jbradshaw 0:e4a10ed6eb92 57
jbradshaw 0:e4a10ed6eb92 58 /** Bulk erase the flash device
jbradshaw 0:e4a10ed6eb92 59 */
jbradshaw 0:e4a10ed6eb92 60 int8_t bulkErase_Helper(void);
jbradshaw 0:e4a10ed6eb92 61
jbradshaw 0:e4a10ed6eb92 62 /** Erase Parameter Sectors
jbradshaw 0:e4a10ed6eb92 63 */
jbradshaw 0:e4a10ed6eb92 64 int8_t parameterSectorErase_Helper(uint32_t address);
jbradshaw 0:e4a10ed6eb92 65
jbradshaw 0:e4a10ed6eb92 66 /** Write a Page
jbradshaw 0:e4a10ed6eb92 67 */
jbradshaw 0:e4a10ed6eb92 68 int8_t writePage_Helper(uint32_t pageNumber, uint8_t *buffer,
jbradshaw 0:e4a10ed6eb92 69 uint32_t offset);
jbradshaw 0:e4a10ed6eb92 70
jbradshaw 0:e4a10ed6eb92 71 /** Read a Page
jbradshaw 0:e4a10ed6eb92 72 * @param
jbradshaw 0:e4a10ed6eb92 73 */
jbradshaw 0:e4a10ed6eb92 74 int8_t readPages_Helper(uint32_t startPageNumber, uint32_t endPageNumber,
jbradshaw 0:e4a10ed6eb92 75 uint8_t *buffer, uint32_t offset);
jbradshaw 0:e4a10ed6eb92 76
jbradshaw 0:e4a10ed6eb92 77 /** Erase a Sector
jbradshaw 0:e4a10ed6eb92 78 @param address Address of sector to erase
jbradshaw 0:e4a10ed6eb92 79 */
jbradshaw 0:e4a10ed6eb92 80
jbradshaw 0:e4a10ed6eb92 81 int8_t sectorErase_Helper(uint32_t address);
jbradshaw 0:e4a10ed6eb92 82 /** Scans through byte pointer for a page worth of data to see if the page is all FFs
jbradshaw 0:e4a10ed6eb92 83 @param ptr Byte pointer to buffer to scan
jbradshaw 0:e4a10ed6eb92 84 @return Returns a 1 if the page is empty, 0 if it is not all FFs
jbradshaw 0:e4a10ed6eb92 85 */
jbradshaw 0:e4a10ed6eb92 86 uint32_t isPageEmpty(uint8_t *ptr);
jbradshaw 0:e4a10ed6eb92 87
jbradshaw 0:e4a10ed6eb92 88 /** Issue a software reset to the flash device
jbradshaw 0:e4a10ed6eb92 89 */
jbradshaw 0:e4a10ed6eb92 90
jbradshaw 0:e4a10ed6eb92 91 uint8_t reset(void);
jbradshaw 0:e4a10ed6eb92 92 /** Enable a hardware reset
jbradshaw 0:e4a10ed6eb92 93 */
jbradshaw 0:e4a10ed6eb92 94
jbradshaw 0:e4a10ed6eb92 95 uint8_t enableHWReset(void);
jbradshaw 0:e4a10ed6eb92 96 /** Read the id byte of this device
jbradshaw 0:e4a10ed6eb92 97 */
jbradshaw 0:e4a10ed6eb92 98
jbradshaw 0:e4a10ed6eb92 99 void readID(uint8_t *id);
jbradshaw 0:e4a10ed6eb92 100
jbradshaw 0:e4a10ed6eb92 101 private:
jbradshaw 0:e4a10ed6eb92 102 int8_t reg_write_read_multiple_quad_last(uint8_t *dataIn, uint8_t numberIn, uint8_t *dataOut, uint8_t numberOut, uint8_t last);
jbradshaw 0:e4a10ed6eb92 103 int8_t reg_write_read_multiple_quad(uint8_t *dataIn, uint8_t numberIn, uint8_t *dataOut, uint8_t numberOut);
jbradshaw 0:e4a10ed6eb92 104 int8_t reg_write_read_multiple_4Wire(uint8_t *bufferOut, uint8_t numberOut, uint8_t *bufferIn, uint8_t numberIn);
jbradshaw 0:e4a10ed6eb92 105 uint8_t spiWriteRead (uint8_t writeNumber,uint8_t *writeData, uint8_t readNumber, uint8_t *readData);
jbradshaw 0:e4a10ed6eb92 106 uint8_t spiWriteRead4Wire(uint8_t writeNumber,uint8_t *writeData, uint8_t readNumber, uint8_t *readData);
jbradshaw 0:e4a10ed6eb92 107
jbradshaw 0:e4a10ed6eb92 108 int8_t writeAnyRegister(uint32_t address, uint8_t data);
jbradshaw 0:e4a10ed6eb92 109 int8_t writeAnyRegister4Wire(uint32_t address, uint8_t data);
jbradshaw 0:e4a10ed6eb92 110 int8_t writeRegisters(void);
jbradshaw 0:e4a10ed6eb92 111 uint8_t wren(void);
jbradshaw 0:e4a10ed6eb92 112 int setQuadMode(void);
jbradshaw 0:e4a10ed6eb92 113 int wren4Wire(void);
jbradshaw 0:e4a10ed6eb92 114 // int8_t setQuadMode();
jbradshaw 0:e4a10ed6eb92 115 int8_t readAnyRegister(uint32_t address, uint8_t *data, uint32_t length);
jbradshaw 0:e4a10ed6eb92 116 int8_t bulkErase(void);
jbradshaw 0:e4a10ed6eb92 117 int8_t pageProgram(uint32_t address, uint8_t *buffer);
jbradshaw 0:e4a10ed6eb92 118 int8_t quadIoRead_Pages(uint32_t address, uint8_t *buffer, uint32_t numberOfPages);
jbradshaw 0:e4a10ed6eb92 119 int8_t checkBusy(void);
jbradshaw 0:e4a10ed6eb92 120 void waitTillNotBusy(void);
jbradshaw 0:e4a10ed6eb92 121 int8_t sectorErase(uint32_t address);
jbradshaw 0:e4a10ed6eb92 122 int8_t parameterSectorErase(uint32_t address);
jbradshaw 0:e4a10ed6eb92 123 void wait_1mS(void);
jbradshaw 0:e4a10ed6eb92 124 void wait_100uS(void);
jbradshaw 0:e4a10ed6eb92 125 void wait_10mS(void);
jbradshaw 0:e4a10ed6eb92 126 };
jbradshaw 0:e4a10ed6eb92 127 #endif /* S25FS512_H_ */