Host software for the MAX30001 ECG, PACE, biopotential, bioimpedance, R-to-R peak sensor. Hosted on the MAX32630FTHR.

Dependencies:   SDFileSystem USBDevice max32630fthr

Fork of MAX30001 SYS EvKit by Emre Eken

MAX30001-MAX32630FTHR ECG Evaluation System

The MAX30001 EVKIT SYS-MBED Evaluation System (EV System) is used to evaluates the MAX30001 sensor, which is an ECG (electrocardiogram), biopotential and bioimpedance analog front end solution for wearable applications. The full evaluation system consists of the MAX32630FTHR board, MAX30001 EVKIT sensor board and the evaluation software. The evaluation kit features ECG, PACE, R-to-R (R-peak timing) detection; bioimpedance (BioZ) AFE; and raw data logging.

The MAX30001 EVKIT evaluation system is assembled, tested and contains the necessary circuitry and connections to evaluate the MAX30001 ECG sensor.

When evaluated as an evaluation system, the MAX32630FTHR board provides the necessary logic rails, master clock, SPI, USB-to-Serial interfaces that are needed to evaluate the MAX30001 sensor board. MAX32630FTHR can be used as an independent development platform.

Communication between the PC and the MAX32630FTHR board is facilitated by a Windows 7, Windows 8 and Windows 10 compatible software that provides a simple and intuitive graphical user interface (GUI).

For more information, visit the wiki pages by clicking the wiki tab above and MAX30001EVSYS product page.

C++ source code, library for the MAX30001 ECG drivers are in the links at the bottom of this page. The sample code includes the ability to log data to the SD card of the MAX32630FTHR.

MAX30001 EVKIT Pinout Connections

/media/uploads/EmreE/max30001_sensor_board_connector_pinout.png

Where to Buy

MAX30001EVSYS-Buy

Committer:
Emre.Eken
Date:
Tue Jul 24 15:22:35 2018 +0300
Revision:
13:6031b0bd9773
Parent:
11:1dde68750ed1
.hgtags is added.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Emre.Eken 11:1dde68750ed1 1 /*******************************************************************************
Emre.Eken 11:1dde68750ed1 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
Emre.Eken 11:1dde68750ed1 3 *
Emre.Eken 11:1dde68750ed1 4 * Permission is hereby granted, free of charge, to any person obtaining a
Emre.Eken 11:1dde68750ed1 5 * copy of this software and associated documentation files (the "Software"),
Emre.Eken 11:1dde68750ed1 6 * to deal in the Software without restriction, including without limitation
Emre.Eken 11:1dde68750ed1 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
Emre.Eken 11:1dde68750ed1 8 * and/or sell copies of the Software, and to permit persons to whom the
Emre.Eken 11:1dde68750ed1 9 * Software is furnished to do so, subject to the following conditions:
Emre.Eken 11:1dde68750ed1 10 *
Emre.Eken 11:1dde68750ed1 11 * The above copyright notice and this permission notice shall be included
Emre.Eken 11:1dde68750ed1 12 * in all copies or substantial portions of the Software.
Emre.Eken 11:1dde68750ed1 13 *
Emre.Eken 11:1dde68750ed1 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
Emre.Eken 11:1dde68750ed1 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Emre.Eken 11:1dde68750ed1 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Emre.Eken 11:1dde68750ed1 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
Emre.Eken 11:1dde68750ed1 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
Emre.Eken 11:1dde68750ed1 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
Emre.Eken 11:1dde68750ed1 20 * OTHER DEALINGS IN THE SOFTWARE.
Emre.Eken 11:1dde68750ed1 21 *
Emre.Eken 11:1dde68750ed1 22 * Except as contained in this notice, the name of Maxim Integrated
Emre.Eken 11:1dde68750ed1 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
Emre.Eken 11:1dde68750ed1 24 * Products, Inc. Branding Policy.
Emre.Eken 11:1dde68750ed1 25 *
Emre.Eken 11:1dde68750ed1 26 * The mere transfer of this software does not imply any licenses
Emre.Eken 11:1dde68750ed1 27 * of trade secrets, proprietary technology, copyrights, patents,
Emre.Eken 11:1dde68750ed1 28 * trademarks, maskwork rights, or any other form of intellectual
Emre.Eken 11:1dde68750ed1 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
Emre.Eken 11:1dde68750ed1 30 * ownership rights.
Emre.Eken 11:1dde68750ed1 31 *******************************************************************************
Emre.Eken 11:1dde68750ed1 32 */
Emre.Eken 11:1dde68750ed1 33
Emre.Eken 11:1dde68750ed1 34 #include "S25FS512_RPC.h"
Emre.Eken 11:1dde68750ed1 35 #include "S25FS512.h"
Emre.Eken 11:1dde68750ed1 36 #include "StringInOut.h"
Emre.Eken 11:1dde68750ed1 37 #include "StringHelper.h"
Emre.Eken 11:1dde68750ed1 38 #include "Peripherals.h"
Emre.Eken 11:1dde68750ed1 39 #include "SDFileSystem.h"
Emre.Eken 11:1dde68750ed1 40
Emre.Eken 11:1dde68750ed1 41 int S25FS512_Reset(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 42 uint32_t reply[1];
Emre.Eken 11:1dde68750ed1 43 Peripherals::s25FS512()->reset();
Emre.Eken 11:1dde68750ed1 44 reply[0] = 0x80;
Emre.Eken 11:1dde68750ed1 45 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken 11:1dde68750ed1 46 return 0;
Emre.Eken 11:1dde68750ed1 47 }
Emre.Eken 11:1dde68750ed1 48
Emre.Eken 11:1dde68750ed1 49 int S25FS512_EnableHWReset(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 50 uint32_t reply[1];
Emre.Eken 11:1dde68750ed1 51 Peripherals::s25FS512()->enableHWReset();
Emre.Eken 11:1dde68750ed1 52 reply[0] = 0x80;
Emre.Eken 11:1dde68750ed1 53 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken 11:1dde68750ed1 54 return 0;
Emre.Eken 11:1dde68750ed1 55 }
Emre.Eken 11:1dde68750ed1 56
Emre.Eken 11:1dde68750ed1 57 int S25FS512_SpiWriteRead(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 58 uint8_t args[16];
Emre.Eken 11:1dde68750ed1 59 uint8_t reply[16];
Emre.Eken 11:1dde68750ed1 60 uint8_t writeNumber;
Emre.Eken 11:1dde68750ed1 61 uint8_t readNumber;
Emre.Eken 11:1dde68750ed1 62 // get the number of bytes to write
Emre.Eken 11:1dde68750ed1 63 ProcessArgs(argStrs, args, 1);
Emre.Eken 11:1dde68750ed1 64 writeNumber = args[0];
Emre.Eken 11:1dde68750ed1 65 ProcessArgs(argStrs, args, writeNumber + 2);
Emre.Eken 11:1dde68750ed1 66 readNumber = args[writeNumber + 1];
Emre.Eken 11:1dde68750ed1 67 FormatReply(reply, readNumber, replyStrs);
Emre.Eken 11:1dde68750ed1 68 return 0;
Emre.Eken 11:1dde68750ed1 69 }
Emre.Eken 11:1dde68750ed1 70
Emre.Eken 11:1dde68750ed1 71 int S25FS512_SpiWriteRead4Wire(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 72 uint8_t args[16];
Emre.Eken 11:1dde68750ed1 73 uint8_t reply[16];
Emre.Eken 11:1dde68750ed1 74 uint8_t writeNumber;
Emre.Eken 11:1dde68750ed1 75 uint8_t readNumber;
Emre.Eken 11:1dde68750ed1 76 // get the number of bytes to write
Emre.Eken 11:1dde68750ed1 77 ProcessArgs(argStrs, args, 1);
Emre.Eken 11:1dde68750ed1 78 writeNumber = args[0];
Emre.Eken 11:1dde68750ed1 79 ProcessArgs(argStrs, args, writeNumber + 2);
Emre.Eken 11:1dde68750ed1 80 readNumber = args[writeNumber + 1];
Emre.Eken 11:1dde68750ed1 81 FormatReply(reply, readNumber, replyStrs);
Emre.Eken 11:1dde68750ed1 82 return 0;
Emre.Eken 11:1dde68750ed1 83 }
Emre.Eken 11:1dde68750ed1 84
Emre.Eken 11:1dde68750ed1 85 int S25FS512_ReadPage(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 86 uint32_t args[2];
Emre.Eken 11:1dde68750ed1 87 uint32_t reply[1];
Emre.Eken 11:1dde68750ed1 88 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken 11:1dde68750ed1 89 reply[0] = 0x80;
Emre.Eken 11:1dde68750ed1 90 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken 11:1dde68750ed1 91 return 0;
Emre.Eken 11:1dde68750ed1 92 }
Emre.Eken 11:1dde68750ed1 93
Emre.Eken 11:1dde68750ed1 94 //int S25FS512_ReadPagesBinary(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 95 // uint32_t args[2];
Emre.Eken 11:1dde68750ed1 96 // uint32_t reply[1];
Emre.Eken 11:1dde68750ed1 97 // uint8_t pageData[256];
Emre.Eken 11:1dde68750ed1 98 //
Emre.Eken 11:1dde68750ed1 99 // uint32_t startPage;
Emre.Eken 11:1dde68750ed1 100 // uint32_t endPage;
Emre.Eken 11:1dde68750ed1 101 // uint32_t page;
Emre.Eken 11:1dde68750ed1 102 //
Emre.Eken 11:1dde68750ed1 103 // ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken 11:1dde68750ed1 104 // startPage = args[0];
Emre.Eken 11:1dde68750ed1 105 // endPage = args[1];
Emre.Eken 11:1dde68750ed1 106 // for (page = startPage; page <= endPage; page++) {
Emre.Eken 11:1dde68750ed1 107 // Peripherals::s25FS512()->readPages_Helper(page, page, pageData, 0);
Emre.Eken 11:1dde68750ed1 108 // putBytes256Block(pageData, 1);
Emre.Eken 11:1dde68750ed1 109 // }
Emre.Eken 11:1dde68750ed1 110 // reply[0] = 0x80;
Emre.Eken 11:1dde68750ed1 111 // FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken 11:1dde68750ed1 112 // return 0;
Emre.Eken 11:1dde68750ed1 113 //}
Emre.Eken 11:1dde68750ed1 114 extern char dataFileName[32];
Emre.Eken 11:1dde68750ed1 115 int S25FS512_ReadPagesBinary(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 116 uint32_t args[2];
Emre.Eken 11:1dde68750ed1 117 uint32_t reply[1];
Emre.Eken 11:1dde68750ed1 118 uint8_t pageData[256];
Emre.Eken 11:1dde68750ed1 119
Emre.Eken 11:1dde68750ed1 120 uint32_t startPage;
Emre.Eken 11:1dde68750ed1 121 uint32_t endPage;
Emre.Eken 11:1dde68750ed1 122 uint32_t page;
Emre.Eken 11:1dde68750ed1 123
Emre.Eken 11:1dde68750ed1 124 ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t));
Emre.Eken 11:1dde68750ed1 125 startPage = args[0];
Emre.Eken 11:1dde68750ed1 126 endPage = args[1];
Emre.Eken 11:1dde68750ed1 127 FILE *fp = NULL;
Emre.Eken 11:1dde68750ed1 128 fp = fopen(dataFileName, "rb");
Emre.Eken 11:1dde68750ed1 129 for (page = startPage-0x12; page <= endPage-0x12; page++) {
Emre.Eken 11:1dde68750ed1 130 memset(pageData, 0xffffffff, sizeof(pageData));
Emre.Eken 11:1dde68750ed1 131 printf("reading from page %d\r\n", page);
Emre.Eken 11:1dde68750ed1 132 if (fp != NULL) {
Emre.Eken 11:1dde68750ed1 133 fseek(fp,page*256,SEEK_SET);
Emre.Eken 11:1dde68750ed1 134 uint8_t count = 0;
Emre.Eken 11:1dde68750ed1 135 while(!feof(fp))
Emre.Eken 11:1dde68750ed1 136 {
Emre.Eken 11:1dde68750ed1 137 printf(".");
Emre.Eken 11:1dde68750ed1 138 pageData[count++] = (unsigned char) fgetc(fp);
Emre.Eken 11:1dde68750ed1 139 if (count == 0) break;
Emre.Eken 11:1dde68750ed1 140 };
Emre.Eken 11:1dde68750ed1 141 }
Emre.Eken 11:1dde68750ed1 142 printf("\r\nEND\r\n");
Emre.Eken 11:1dde68750ed1 143 putBytes256Block(pageData, 1);
Emre.Eken 11:1dde68750ed1 144 }
Emre.Eken 11:1dde68750ed1 145 if (fp != NULL) fclose(fp);
Emre.Eken 11:1dde68750ed1 146 reply[0] = 0x80;
Emre.Eken 11:1dde68750ed1 147 FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs);
Emre.Eken 11:1dde68750ed1 148 return 0;
Emre.Eken 11:1dde68750ed1 149 }
Emre.Eken 11:1dde68750ed1 150
Emre.Eken 11:1dde68750ed1 151 int S25FS512_ReadId(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 152 char str[32];
Emre.Eken 11:1dde68750ed1 153 uint8_t data[128];
Emre.Eken 11:1dde68750ed1 154 Peripherals::s25FS512()->readIdentification(data, sizeof(data));
Emre.Eken 11:1dde68750ed1 155 Peripherals::s25FS512()->readIdentification(data, sizeof(data));
Emre.Eken 11:1dde68750ed1 156 sprintf(str, "%02X%02X%02X%02X", data[0], data[1], data[2], data[3]);
Emre.Eken 11:1dde68750ed1 157 strcpy(replyStrs[0], str);
Emre.Eken 11:1dde68750ed1 158 return 0;
Emre.Eken 11:1dde68750ed1 159 }
Emre.Eken 11:1dde68750ed1 160 int SDCard_IsReady(char argStrs[32][32], char replyStrs[32][32]) {
Emre.Eken 11:1dde68750ed1 161
Emre.Eken 11:1dde68750ed1 162 DigitalIn *detect = Peripherals::SDDetect();
Emre.Eken 11:1dde68750ed1 163
Emre.Eken 11:1dde68750ed1 164 bool isReady = false;
Emre.Eken 11:1dde68750ed1 165
Emre.Eken 11:1dde68750ed1 166 if(detect->read())
Emre.Eken 11:1dde68750ed1 167 {
Emre.Eken 11:1dde68750ed1 168 isReady = false;
Emre.Eken 11:1dde68750ed1 169 strcpy(replyStrs[0], "not_ok");
Emre.Eken 11:1dde68750ed1 170 return 0;
Emre.Eken 11:1dde68750ed1 171 }
Emre.Eken 11:1dde68750ed1 172
Emre.Eken 11:1dde68750ed1 173 Peripherals::sdFS()->disk_initialize();
Emre.Eken 11:1dde68750ed1 174 FILE *fp = fopen("/sd/test", "r");
Emre.Eken 11:1dde68750ed1 175 if ( fp != NULL)
Emre.Eken 11:1dde68750ed1 176 isReady = true;
Emre.Eken 11:1dde68750ed1 177 else
Emre.Eken 11:1dde68750ed1 178 {
Emre.Eken 11:1dde68750ed1 179 FILE *fp = fopen("/sd/test", "w");
Emre.Eken 11:1dde68750ed1 180 if ( fp != NULL)
Emre.Eken 11:1dde68750ed1 181 isReady = true;
Emre.Eken 11:1dde68750ed1 182 }
Emre.Eken 11:1dde68750ed1 183
Emre.Eken 11:1dde68750ed1 184 if (fp != NULL) fclose(fp);
Emre.Eken 11:1dde68750ed1 185
Emre.Eken 11:1dde68750ed1 186 if (isReady)
Emre.Eken 11:1dde68750ed1 187 strcpy(replyStrs[0], "ok");
Emre.Eken 11:1dde68750ed1 188 else
Emre.Eken 11:1dde68750ed1 189 strcpy(replyStrs[0], "not_ok");
Emre.Eken 11:1dde68750ed1 190 return 0;
Emre.Eken 11:1dde68750ed1 191 }