7 years, 2 months ago.

Not able to access the heart rate monitor in the Hexiwear board

I'm having problems accessing the heart rate monitor in the Hexiwear board. I'm able to talk to other I2C devices on the board such as the accelerometer and the barometric pressure sensor. So, the problem does not seem to be in my I2C driver. I wonder if I need to do a hard reset of the heart rate monitor chip first. However, according to the schematics, there is no reset pin for the heart rate monitor. The sample code from NXP does seem to indicate that pin PTA29 is a Power pin for the Heart rate monitor. However, the schematics does not show that. Anyway, I tried using this pin in the same way as the NXP sample code, but still no luck. I2C communication still fails.

Any pointers to relevant information of how enable and access the Hexiwear's heart rate monitor would be highly appreciated

Thanks,

German

Question relating to:

Hexiwear team to share code, project ideas, trick and tips

1 Answer

7 years, 2 months ago.

title

#include "mbed.h"
#define MAX30101_I2C_ADDRESS 0xAE  //pins SA0,SA1=0

DigitalOut led1(LED1);
DigitalOut EN(PTB12);
DigitalOut LDO_EN(PTA29);
I2C i2c(PTB1 , PTB0 ); 

Serial pc(USBTX, USBRX);// Initialize Serial port


// main() runs in its own thread in the OS
int main() {
    char cmd[2];
    EN = 0;
    LDO_EN = 1;
    int slave_addr, addr;
    slave_addr = MAX30101_I2C_ADDRESS;
    while (true) {
        led1 = !led1;
        for (addr = 0; addr <= 0xFF; addr++) {
            cmd[0] = addr;
            i2c.write(slave_addr, cmd, 1);
            i2c.read(slave_addr, cmd, 1);
            printf("0x%X 0x%X 0x%X\n", slave_addr, addr, cmd[0]);
            wait(0.1);
        }
    }
}