aromring / MAX30102_by_RF

Arduino C code for MAX30102 pulse oximetry sensor (MAXIM Integrated, Inc.)
166 stars 73 forks source link

Can't get past maxim_max30102_init(); on ESP32-C3 #40

Closed moeburn closed 2 months ago

moeburn commented 4 months ago

No idea what the issue is, but I saw some other people got it working on a regular ESP32, so I thought I'd share my troubleshooting trying to get this sketch to work on an ESP32-C3.

I know the MAX board works because I have tested it with the Sparkfun library and it works fine there.

But in this sketch, nothing happens whatsoever - the LEDs do not light up, and not even a single word gets printed to the Serial monitor. Even if DEBUG is defined/uncommented.

Even if I add "Serial.println("hellothere!!!");" after Serial.begin, it never prints.

...until I comment out the line "maxim_max30102_init();".

In fact I can strip down the code to almost nothing:

#include "algorithm_by_RF.h"
#include "max30102.h"

void setup() {
  Serial.begin(115200);
  Serial.println("hellothere!!!");

  //maxim_max30102_init();  //initialize the MAX30102

void loop() {
  Serial.println("hellothere!!!");
}

If that init line is commented, the serial prints "hellothere" just fine. But if I uncomment the maxim_max30102_init line, the serial never prints anything.

I have no idea how this line being present is blocking the Serial print from showing up since the Serial print line is before the init line.

I have dug into the cpp file and played around with things like I2C speeds, comparing it to the working Sparkfun "begin" function, but I could not get that init function to work. I have no idea why, or what is different about the C3 that is making it not work.

The C3 supposedly supports all the way up to 400kbps I2C. But again I tried changing it to 100000 and it still didn't work, so I don't think the I2C speed is the issue.

aromring commented 2 months ago

Sorry, I have no experience with ESP32-C3.