MBED library software for the MAX30001 ECG, PACE, biopotential, bioimpedance, R-to-R peak sensor.

Dependencies:   USBDevice max32630fthr SDFileSystem

Fork of MAX30001-MAX32630FTHR-ECG-EVKIT by Maxim Integrated

PC_GUI_MAX30001EVSYS_Interface_Document

1. Introduction

This document describes and defines the protocol between the MAX30001 EvKit System board and the associated MAX30001 GUI that runs on the PC. The protocol is called RPC, Remote Protocol Communications. The GUI is used to configure the MAX30001 sensor and visualize/store the sensed data.

2. RPC Protocol

2.1 RPC Command Overview

RPC Commands are sent from the GUI to the MAX30001 EvKit System.

  • RPC Commands follow the following format:
    • /<Object name>/<Method name> <Arguments separated by spaces><CR LF>
  • All arguments are expressed in hexadecimal format unless otherwise noted.
  • The return data is delimited by spaces and are in hexadecimal format unless otherwise noted.
  • The return data is terminated by a <CR LF>.
  • An example command is: /MAX30001/ReadReg 01: This command reads 1 byte from register address 0x01 from the MAX30001 sensor.

2.2 RPC Command, Response Overview

The MAX3001 EvKit System responds to commands with /80 unless otherwise specified.

2.3 RPC Command Details

2.3.1 Version Command

/System/ReadVer

This command queries MAX32630 firmware version. An example response to this command is: “Max30001 FW Version 1.0.0 04/13/17”.

2.3.2 I2C Command

/System/WriteRead

This command enables the user to send an I2C write and read command to the I2C bus on EvKit. A typical usage is to write and read data from the PMIC.

I2C Commands follow the following format:

/I2c/WriteRead Instance slaveAddress writeNumber <dataToWrite> readNumber<CR LF>

The table below provides details for the above parameters:

ParameterDescription
InstanceThe I2C instance of Max32630
slaveAddressSlave address of the device
writeNumberNumber of bytes to write
dataToWriteA series of hex values separated by spaces that are to be written
readNumberNumber of bytes to read

For example:

/I2c/WriteRead 1 A0 3 11 22 33 2

This example command performs a write and read operation using I2C instance 1 and slave address A0. It writes the three hex data bytes: 11 22 33 and it request that 2 bytes of data be read. The 2 bytes of data requested will be sent back as a response to this command.

2.3.3 LED Commands

The following commands are used to control the LED on the MAX32630FTHR board:

/Led/Blink ms

This command sets the blinking period for the LED on MAX32630FTHR board in milliseconds.

/Led/Pattern pattern

This command sets the blinking pattern for the LED on MAX32630FTHR board. The pattern is based on the zeros and ones of a 32-bit number specified in the “pattern” parameter.

/Led/Off

This command turns off the LED on the Max32630FTHR board.

/Led/On

This command turns on the LED on the Max32630FTHR board.

2.3.4

/SDCard/IsReady

This command checks the communications to the SD card and the verifies that the file system is ready for read/write operations.
The response to this command will be one of the following:
okThis means that the SD card is ready.
not okThis means that the SD card is not inserted or communications to the SD card is not working yet.

/S25FS512/ReadPagesBinary startPage endPage

This command reads a page from flash, and the response is binary (non-ascii) data. The parameters are described in the following table:
ParameterDescription
startPageThe starting page to read from
endPageThe last page to read from

2.3.5 Self-Testing Command

/Testing/Test_MAX30001

This command initiates the self-test for the MAX30001; the response is either the string PASS or FAIL followed by detailed results of the test.

2.3.6

The following commands are used for configuring a mission and reading/writing data to the SD card: /Logging/StartMissionDefine

This command means that a mission is being defined with subsequent commands.

/Logging/AppendMissionCmd missionString

This command specifies an RPC command (missionString) that becomes part of a mission.

/Logging/EndMissionDefine

This command means that the definition of a mission has been completed.

/Logging/WriteMission

This command saves the mission to the SD card.

/Logging/ReadMission

This command saves the mission to the SD card.

/Logging/EraseMission

This command erase the missions stored on the SD card.

/Logging/EraseWrittenSectors

This command erases all the logged data stored on the SD card.

/Logging/Start

This command provides the ability to start a data logging session that is stored to the SD card.

/Logging/StartLoggingFlash

This command causes the data to be logged to the SD card.

/Logging/StartLoggingUsb

This command streams data to USB. (A PC terminal emulator such as TerraTerm can be used.)

2.3.7 MAX3001 Commands

The following commands are used to interface to the MAX30001 chip.

/MAX30001/BIOZ_InitStart En_bioz Openp Openn Calp_sel Caln_sel CG_mode B_fit Rate Ahpf Ext_rbias Gain Dhpf Dlpf Fcgen Cgmon Cgmag Phoff Inapow_mode

This command enables the BioZ interrupts interrupts and streaming. The streaming response is detailed in section 2.3.8. The table below describes the parameters that are sent with this command.
ParameterDescription
En_biozBIOZ Channel Enable <CNFG_GEN register>
OpenpOpen the BIP Input Switch <CNFG_BMUX register>
OpennOpen the BIN Input Switch <CNFG_BMUX register>
Calp_selpBIP Calibration Selection <CNFG_BMUX register>
Calp_selnBIN Calibration Selection <CNFG_BMUX register>
CG_modeBIOZ Current Generator Mode Selection <CNFG_BMUX register>
B_fitBIOZ FIFO Interrupt Threshold (issues BINT based on number of unread FIFO records) <MNGR_INT register>
RateBIOZ Data Rate <CNFG_BIOZ register>
AhpfBIOZ/PACE Channel Analog High Pass Filter Cutoff Frequency and Bypass <CNFG_BIOZ register>
Ext_rbiasExternal Resistor Bias Enable <CNFG_BIOZ register>
GainBIOZ Channel Gain Setting <CNFG_BIOZ register>
DhpfBIOZ Channel Digital High Pass Filter Cutoff Frequency <CNFG_BIOZ register>
DlpfBIOZ Channel Digital Low Pass Filter Cutoff Frequency <CNFG_BIOZ register>
FcgenBIOZ Current Generator Modulation Frequency <CNFG_BIOZ register>
CgmonBIOZ Current Generator Monitor <CNFG_BIOZ register>
CgmagBIOZ Current Generator Magnitude <CNFG_BIOZ register>
PhoffBIOZ Current Generator Modulation Phase Offset <CNFG_BIOZ register>
Inapow_modeBIOZ Channel Instrumentation Amplifier (INA) Power Mode <CNFG_BIOZ Register>

/MAX30001/CAL_InitStart En_Vcal Vmode Vmag Fcal Thigh Fifty

This command starts the CAL signal within the MAX30001 device.
ParameterDescription
En_VcalCalibration Source (VCALP and VCALN) Enable
VmodeCalibration Source Mode Selection
VmagCalibration Source Magnitude Selection (VMAG)
FcalCalibration Source Frequency Selection (FCAL)
ThighCalibration Source Time High Selection
FiftyCalibration Source Duty Cycle Mode Selection

/MAX30001/ECG_InitStart En_ecg Openp Openn Pol Calp_sel Caln_sel E_fit Rate Gain Dhpf Dlpf

This command enables the ECG interrupts and streaming. The streaming response is detailed in section 2.3.8.
ParameterDescription
En_ecgECG Channel Enable <CNFG_GEN register="" bits>
OpenpOpen the ECGP Input Switch (most often used for testing and calibration studies) <CNFG_EMUX register="" bits>
OpennOpen the ECGN Input Switch (most often used for testing and calibration studies) <CNFG_EMUX register="" bits>
Calp_selECGP Calibration Selection <CNFG_EMUX register="" bits>
Caln_selECGN Calibration Selection <CNFG_EMUX register="" bits>
E_fitECG FIFO Interrupt Threshold (issues EINT based on number of unread FIFO records) <CNFG_GEN register="" bits>
Clr_rrintRTOR R Detect Interrupt (RRINT) Clear Behavior <CNFG_GEN register="" bits>
RateECG Data Rate
GainECG Channel Gain Setting
DhpfECG Channel Digital High Pass Filter Cutoff Frequency
DlpfECG Channel Digital Low Pass Filter Cutoff Frequency

/MAX30001/ECGFast_Init Clr_Fast Fast Fast_Th

This command enables the ECG Fast mode interrupts interrupts and streaming. The streaming response is detailed in section 2.3.8.
ParameterDescription
Clr_FastFAST MODE Interrupt Clear Behavior <MNGR_INT register>
FastECG Channel Fast Recovery Mode Selection (ECG High Pass Filter Bypass) <MNGR_DYN register>
Fast_ThAutomatic Fast Recovery Threshold

/MAX30001/Enable_BIOZ_LeadON

This command enables the BIOZ Lead ON.

/MAX30001/Enable_ECG_LeadON

This command enables the ECG LeadON.

/MAX30001/INT_assignment en_enint_loc en_eovf_loc en_fstint_loc en_dcloffint_loc en_bint_loc en_bovf_loc en_bover_loc en_bundr_loc en_bcgmon_loc en_pint_loc en_povf_loc en_pedge_loc en_lonint_loc en_rrint_loc en_samp_loc intb_Type int2b_Type

This command allows one to enable the interrupt for the MAX30001. The parameters to this command are described below:
ParameterDescription
en_enint_loc----------------------------------------------
en_eovf_loc
en_fstint_loc
en_dcloffint_loc
en_bint_loc
en_bovf_loc
en_bover_loc
en_bundr_locAll of these arguments can be
en_bcgmon_locconfigured to generate an
en_pint_locinterrupt on either INTB or INT2B
en_povf_locor NONE
en_pedge_loc
en_lonint_loc
en_rrint_loc
en_samp_loc----------------------------------------------
intb_TypeINTB Port Type (EN_INT Selections).
int2b_TypeINT2B Port Type (EN_INT2 Selections)

/MAX30001/PACE_InitStart En_pace Clr_pedge Pol Gn_diff_off Gain Aout_lbw Aout Dacp Dacn

This command enables the PACE interrupts and streaming. The streaming response is detailed in section 2.3.8
ParameterDescription
En_pacePACE Channel Enable <CNFG_GEN register>
Clr_pedgePACE Edge Detect Interrupt (PEDGE) Clear Behavior <MNGR_INT register>
PolPACE Input Polarity Selection <CNFG_PACE register>
Gn_diff_offPACE Differentiator Mode <CNFG_PACE register>
GainPACE Channel Gain Selection <CNFG_PACE register>
Aout_lbwPACE Analog Output Buffer Bandwidth Mode <CNFG_PACE register>
AoutPACE Single Ended Analog Output Buffer Signal Monitoring Selection <CNFG_PACE register>
Dacp (4bits):PACE Detector Positive Comparator Threshold <CNFG_PACE register>
DacnPACE Detector Negative Comparator Threshold <CNFG_PACE register>

/MAX30001/Rbias_FMSTR_Init En_rbias Rbias Rbiasp Rbiasn Fmstr

This command configures the Rbias of the MAX30001. The parameters to this command are described below:
ParameterDescription
En_rbiasEnable and Select Resitive Lead Bias Mode
RbiasResistive Bias Mode Value Selection
RbiaspEnables Resistive Bias on Positive Input
RbiasnEnables Resistive Bias on Negative Input
FmstrSelects Master Clock Frequency

/MAX30001/Read_LeadON

This command reads the Lead ON ECG status. The response is either ON or OFF.

/MAX30001/ReadReg address

This command site reads data from the MAX30001 register specified by the address.

/MAX30001/WriteReg address data

This command site data to the MAX30001 and the parameter description is below:
ParameterDescription
AddressRegister address to write
DataData to write

/MAX30001/RtoR_InitStart En_rtor Wndw Gain Pavg Ptsf Hoff Ravg Rhsf Clr_rrint

This command enables the RtoR interrupts and streaming. The streaming response is detailed in section 2.3.8
ParameterDescription
En_rtorECG RTOR Detection Enable <RTOR1 register>
WndwR to R Window Averaging (Window Width = RTOR_WNDW[3:0]*8mS) <RTOR1 register>
GainR to R Gain (where Gain = 2^RTOR_GAIN[3:0], plus an auto-scale option) <RTOR1 register>
Pavg
PtsfR to R Peak Averaging Weight Factor <RTOR1 register>
HoffR to R minimum Hold Off <RTOR2 register>
RavgR to R Interval Averaging Weight Factor <RTOR2 register>
RhsfR to R Interval Hold Off Scaling Factor <RTOR2 register>
Clr_rrintRTOR Detect Interrupt Clear behaviour <MNGR_INT register>

/MAX30001/Start

This command starts the streaming of the MAX30001 data. The data streamed depends on the previous MAX30001 InitStart RPC commands. Section 2.3.8 describes the streamed response.

/MAX30001/StartTest

This command initiates the self-test for the MAX30001; interrupts are verified in this test.

/MAX30001/Stop

This command stops the streaming and interrupts of the MAX30001 device.

/MAX30001/Stop_BIOZ

This command stops BIOZ streaming and interrupts.

/MAX30001/Stop_Cal

This command stops the MAX30001 Cal mode

/MAX30001/Stop_ECG

This command stops the ECG streaming and interrupts.

/MAX30001/Stop_PACE

This command stops the PACE streaming and interrupts.

/MAX30001/Stop_RtoR

This command stops the RtoR streaming and interrupts.

/MAX30001/WriteReg address data

This command site data to the MAX30001 and the parameter description is below:
ParameterDescription
AddressRegister address to write
DataData to write

2.3.8 MAX3001 Streamed Data Response

Streamed Data Packet Responses are periodic messages sent from the MAX30001 Evkit System to the GUI.

The streamed data packet is in the format of:

Packet IDTimeStampPayload LengthPayLoad

All elements of the streamed data packet are hexadecimal numbers and the stream data packet is terminated with <CR LF>.

Packet ID Definitions and Associated Payloads
Packet IDDecoded Packet IDPayload Format corresponding to Packet ID
0x30Max30001 ECGECG ECG …
0x31Max30001 PacePace Pace …
0x32Max30001 RtoRRtoR
0x33Max30001 BioZBioZ BioZ
0x34Max30001 Lead Off DC
0x35Max30001 Lead Off AC
0x36Max30001 BCGMON
0x37Max30001 ACLEADON
TimeStamps

This is the time stamp associated with this packet.

Payload Length

The Payload Length is the number of fields in the Payload

Payload

The Payload is sensor data that is sent according to the Packet ID.

An example response is: 30 11223344 1 1BF

The data for the above response has the following meaning:

  • 30 – Signifies that the Packet ID for Max30001 ECG data
  • 11223344 – This is the time stamp associated with this packet.
  • 1 – Signifies that there is one field in the Payload
  • 1BF –This is the measurement data that is returned, 0x1BF

All wikipages