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
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

Where to Buy
Diff: main.cpp
- Revision:
- 11:1dde68750ed1
- Parent:
- 4:10d2c2a56c2a
diff -r 886717d6980d -r 1dde68750ed1 main.cpp
--- a/main.cpp Mon Jul 09 17:45:43 2018 +0300
+++ b/main.cpp Tue Jul 24 15:15:22 2018 +0300
@@ -32,24 +32,23 @@
*/
#include "mbed.h"
#include "max32630fthr.h"
-#include "SDBlockDevice.h"
#include "USBSerial.h"
-#include "QuadSpiInterface.h"
-#include "S25FS512.h"
+#include "RpcServer.h"
+#include "StringInOut.h"
+#include "Peripherals.h"
#include "MAX30001.h"
-#include "HspLed.h"
+#include "DataLoggingService.h"
#include "PushButton.h"
+#include "USBSerial.h"
+#include "Streaming.h"
+#include "SDFileSystem.h"
#include "version.h"
-#include "Peripherals.h"
-#include "Streaming.h"
-#include "RpcServer.h"
-#include "DataLoggingService.h"
-#include "StringInOut.h"
+
-//Init PMIC(Power Management IC) on MAX32630FTHR board and set logic thresholds to 3.3V
+//Init PMIC on FTHR board and set logic thresholds to 3.3V
MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
-SDBlockDevice sd(P0_5, P0_6, P0_4, P0_7); //mosi, miso, sclk, cs
+SDFileSystem sd(P0_5, P0_6, P0_4, P0_7, "sd"); // mosi, miso, sclk, cs
///
/// wire Interfaces
@@ -57,19 +56,20 @@
/// Define with Maxim VID and a Maxim assigned PID, set to version 0x0001 and non-blocking
USBSerial usbSerial(0x0b6a, 0x7531, 0x0001, false);
+
//SD card insertion detection pin
DigitalIn SDDetect(P2_2, PullUp);
+
/// DigitalOut for CS
DigitalOut cs(P5_6);
-
/// SPI Master 2 with SPI0_SS for use with MAX30001
SPI spi(SPI2_MOSI, SPI2_MISO, SPI2_SCK); // used by MAX30001
-
-QuadSpiInterface quadSpiInterface(SPI1_MOSI, SPI1_MISO, SPI1_SCK,SPI1_SS); // used by S25FS512
-
+/// SPI Master 1
+QuadSpiInterface quadSpiInterface(SPI1_MOSI, SPI1_MISO, SPI1_SCK,
+ SPI1_SS); // used by S25FS512
///Debug port
-Serial Debug(USBTX, USBRX);
+Serial debug(USBTX, USBRX);
///
/// Devices
@@ -77,136 +77,132 @@
/// External Flash
S25FS512 s25fs512(&quadSpiInterface);
-
/// ECG device
MAX30001 max30001(&spi, &cs);
-
InterruptIn max30001_InterruptB(P5_5);
InterruptIn max30001_Interrupt2B(P5_4);
+
/// HSP platform LED
HspLed hspLed(LED_RED);
-
/// Packet TimeStamp Timer, set for 1uS
Timer timestampTimer;
-
/// HSP Platform push button
PushButton pushButton(SW1);
-int main()
-{
- //boost baudrate so we can get messages while running the gui
- Debug.baud(115200);
+int main() {
+
+ //boost baudrate so we can get messages while running gui
+ debug.baud(115200);
+
+ // local input state of the RPC
+ int inputState;
+ // RPC request buffer
+ char request[128];
+ // RPC reply buffer
+ char reply[128];
- // local input state of the RPC
- int inputState;
- // RPC request buffer
- char request[128];
- // RPC reply buffer
- char reply[128];
+ // display start banner
+ debug.printf("Maxim Integrated mbed hSensor %d.%d.%d %02d/%02d/%02d\n",
+ VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH,
+ VERSION_MONTH, VERSION_DAY, VERSION_SHORT_YEAR);
+ fflush(stdout);
- // display start banner
- Debug.printf("Maxim Integrated mbed hSensor %d.%d.%d %02d/%02d/%02d\n",
- VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH,
- VERSION_MONTH, VERSION_DAY, VERSION_SHORT_YEAR);
- fflush(stdout);
-
- // turn on the red led
- Debug.printf("Init HSPLED...\n");
- fflush(stdout);
- hspLed.on();
+ // turn on red led
+ debug.printf("Init HSPLED...\n");
+ fflush(stdout);
+ hspLed.on();
- // set NVIC priorities for GPIO to prevent priority inversion
- Debug.printf("Init NVIC Priorities...\n");
- fflush(stdout);
- NVIC_SetPriority(GPIO_P0_IRQn, 5);
- NVIC_SetPriority(GPIO_P1_IRQn, 5);
- NVIC_SetPriority(GPIO_P2_IRQn, 5);
- NVIC_SetPriority(GPIO_P3_IRQn, 5);
- NVIC_SetPriority(GPIO_P4_IRQn, 5);
- NVIC_SetPriority(GPIO_P5_IRQn, 5);
- NVIC_SetPriority(GPIO_P6_IRQn, 5);
- // used by the MAX30001
- NVIC_SetPriority(SPIM2_IRQn, 0);
+ // set NVIC priorities for GPIO to prevent priority inversion
+ debug.printf("Init NVIC Priorities...\n");
+ fflush(stdout);
+ NVIC_SetPriority(GPIO_P0_IRQn, 5);
+ NVIC_SetPriority(GPIO_P1_IRQn, 5);
+ NVIC_SetPriority(GPIO_P2_IRQn, 5);
+ NVIC_SetPriority(GPIO_P3_IRQn, 5);
+ NVIC_SetPriority(GPIO_P4_IRQn, 5);
+ NVIC_SetPriority(GPIO_P5_IRQn, 5);
+ NVIC_SetPriority(GPIO_P6_IRQn, 5);
+ // used by the MAX30001
+ NVIC_SetPriority(SPIM2_IRQn, 0);
- // Be able to statically reference these devices anywhere in the application
- Peripherals::setS25FS512(&s25fs512);
- Peripherals::setUSBSerial(&usbSerial);
- Peripherals::setTimestampTimer(×tampTimer);
- Peripherals::setHspLed(&hspLed);
- Peripherals::setPushButton(&pushButton);
- Peripherals::setMAX30001(&max30001);
- Peripherals::setSdFS(&sd);
- Peripherals::setSDDetect(&SDDetect);
+ // Be able to statically reference these devices anywhere in the application
+ Peripherals::setS25FS512(&s25fs512);
+ Peripherals::setUSBSerial(&usbSerial);
+ Peripherals::setTimestampTimer(×tampTimer);
+ Peripherals::setHspLed(&hspLed);
+ Peripherals::setPushButton(&pushButton);
+ Peripherals::setMAX30001(&max30001);
+ Peripherals::setSdFS(&sd);
+ Peripherals::setSDDetect(&SDDetect);
- // init the S25FS256 external flash device
- Debug.printf("Init S25FS512...\n");
- fflush(stdout);
- s25fs512.init();
+ // init the S25FS256 external flash device
+ debug.printf("Init S25FS512...\n");
+ fflush(stdout);
+ s25fs512.init();
- // start blinking led1
- Debug.printf("Init HSPLED Blink...\n");
- fflush(stdout);
- hspLed.blink(1000);
+ // start blinking led1
+ debug.printf("Init HSPLED Blink...\n");
+ fflush(stdout);
+ hspLed.blink(1000);
- //
- // MAX30001
- //
- Debug.printf("Init MAX30001 callbacks, interrupts...\n");
- fflush(stdout);
- max30001_InterruptB.disable_irq();
- max30001_Interrupt2B.disable_irq();
- max30001_InterruptB.mode(PullUp);
- max30001_InterruptB.fall(&MAX30001Mid_IntB_Handler);
- max30001_Interrupt2B.mode(PullUp);
- max30001_Interrupt2B.fall(&MAX30001Mid_Int2B_Handler);
- max30001_InterruptB.enable_irq();
- max30001_Interrupt2B.enable_irq();
- MAX30001_AllowInterrupts(1);
- max30001.max30001_sw_rst(); // Do a software reset of the MAX30001
- max30001.max30001_INT_assignment(MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_enint_loc, en_eovf_loc, en_fstint_loc,
- MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_dcloffint_loc, en_bint_loc, en_bovf_loc,
- MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_bover_loc, en_bundr_loc, en_bcgmon_loc,
- MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_pint_loc, en_povf_loc, en_pedge_loc,
- MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, // en_lonint_loc, en_rrint_loc, en_samp_loc,
- MAX30001::MAX30001_INT_ODNR, MAX30001::MAX30001_INT_ODNR); // intb_Type, int2b_Type)
- max30001.onDataAvailable(&StreamPacketUint32);
-
- // initialize the RPC server
- Debug.printf("Init RPC Server...\n");
- fflush(stdout);
- RPC_init();
+ //
+ // MAX30001
+ //
+ debug.printf("Init MAX30001 callbacks, interrupts...\n");
+ fflush(stdout);
+ max30001_InterruptB.disable_irq();
+ max30001_Interrupt2B.disable_irq();
+ max30001_InterruptB.mode(PullUp);
+ max30001_InterruptB.fall(&MAX30001Mid_IntB_Handler);
+ max30001_Interrupt2B.mode(PullUp);
+ max30001_Interrupt2B.fall(&MAX30001Mid_Int2B_Handler);
+ max30001_InterruptB.enable_irq();
+ max30001_Interrupt2B.enable_irq();
+ MAX30001_AllowInterrupts(1);
+ max30001.max30001_sw_rst(); // Do a software reset of the MAX30001
+ max30001.max30001_INT_assignment(MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_enint_loc, en_eovf_loc, en_fstint_loc,
+ MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_dcloffint_loc, en_bint_loc, en_bovf_loc,
+ MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_NO_INT, // en_bover_loc, en_bundr_loc, en_bcgmon_loc,
+ MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, MAX30001::MAX30001_NO_INT, // en_pint_loc, en_povf_loc, en_pedge_loc,
+ MAX30001::MAX30001_INT_2B, MAX30001::MAX30001_INT_B, MAX30001::MAX30001_NO_INT, // en_lonint_loc, en_rrint_loc, en_samp_loc,
+ MAX30001::MAX30001_INT_ODNR, MAX30001::MAX30001_INT_ODNR); // intb_Type, int2b_Type)
+ max30001.onDataAvailable(&StreamPacketUint32);
- // initialize the logging service
- Debug.printf("Init LoggingService...\n");
- fflush(stdout);
- LoggingService_Init();
-
- // initialize the SD disk
- sd.init();
-
- // start main loop
- Debug.printf("Start main loop...\n");
- fflush(stdout);
+ // initialize the RPC server
+ debug.printf("Init RPC Server...\n");
+ fflush(stdout);
+ RPC_init();
+ // initialize the logging service
+ debug.printf("Init LoggingService...\n");
+ fflush(stdout);
+ LoggingService_Init();
+ // initialize the SD disk
+ sd.disk_initialize();
- while(1)
- {
- // get a RPC string if one is available
- inputState = getLine(request, sizeof(request));
- // if a string has been captured, process string
- if (inputState == GETLINE_DONE)
- {
- //Send request to debug port
- Debug.printf(request);
- // process the RPC string
- RPC_call(request, reply);
- //Send reply to debug port
- Debug.printf(reply);
- // output the reply
- putStr(reply);
- }
+ // start main loop
+ debug.printf("Start main loop...\n");
+ fflush(stdout);
+
+ while (1)
+ {
+ // get a RPC string if one is available
+ inputState = getLine(request, sizeof(request));
+ // if a string has been captured, process string
+ if (inputState == GETLINE_DONE)
+ {
+ //Send request to debug port
+ debug.printf(request);
+ // process the RPC string
+ RPC_call(request, reply);
+ //Send reply to debug port
+ debug.printf(reply);
+ // output the reply
+ putStr(reply);
+ }
+
+ // process any logging or streaming requests
+ LoggingService_ServiceRoutine();
+ }
+}
- // process any logging or streaming requests
- LoggingService_ServiceRoutine();
- }
-}

ECG, PACE, R-to-R heart peak, Bio-Z, Biopotential sensor Evaluation Kit MAX30001