As this issue suggests I change the mbed version
this is my code:
#include "mbed.h"
#include "MAX14720.h"
#include "MAX30205.h"
/// define the HVOUT Boost Voltage default for the MAX14720 PMIC
#define HVOUT_VOLTAGE 4500 // set to 4500 mV
/// define all I2C addresses
#define MAX30205_I2C_SLAVE_ADDR_TOP (0x92)
#define MAX30205_I2C_SLAVE_ADDR_BOTTOM (0x90)
#define MAX14720_I2C_SLAVE_ADDR (0x54)
#define BMP280_I2C_SLAVE_ADDR (0xEC)
#define MAX30101_I2C_SLAVE_ADDR (0xAE)
#define LIS2DH_I2C_SLAVE_ADDR (0x32)
///
/// wire Interfaces
///
/// Define with Maxim VID and a Maxim assigned PID, set to version 0x0001 and non-blocking
//USBSerial usbSerial(0x0b6a, 0x0100, 0x0001, false);
/// I2C Master 1
I2C i2c1(I2C1_SDA, I2C1_SCL); // used by MAX30205 (1), MAX30205 (2), BMP280
/// I2C Master 2
I2C i2c2(I2C2_SDA, I2C2_SCL); // used by MAX14720, MAX30101, LIS2DH
/// SPI Master 0 with SPI0_SS for use with MAX30001
SPI spi(SPI0_MOSI, SPI0_MISO, SPI0_SCK, SPI0_SS); // used by MAX30001
/// SPI Master 1
//QuadSpiInterface quadSpiInterface(SPI1_MOSI, SPI1_MISO, SPI1_SCK,
// SPI1_SS); // used by S25FS512
///
/// Devices
///
/// Pressure Sensor
//BMP280 bmp280(&i2c1, BMP280_I2C_SLAVE_ADDR);
/// Top Local Temperature Sensor
MAX30205 MAX30205_top(&i2c1, MAX30205_I2C_SLAVE_ADDR_TOP);
/// Bottom Local Temperature Sensor
MAX30205 MAX30205_bottom(&i2c1, MAX30205_I2C_SLAVE_ADDR_BOTTOM);
DigitalOut led(LED1);
//Serial
Serial pc(USBTX, USBRX);
int main()
{
// Assign turnOff function to falling edge of button
//button.fall(&turnOff);
// Wait 1 second to see the buck-boost regulator turn on
int32_t ret;
uint16_t rawTemp_top;
uint16_t rawTemp_bottom;
float celsius_top, celsius_bottom;
uint32_t expandTemperatureValue=0;
while(1) {
// read temperature values
MAX30205_top.readTemperature(rawTemp_top);
//convert to celcius
celsius_top = MAX30205_top.toCelsius(rawTemp_top);
pc.printf("Top Temperature: %f\n\r",celsius_top);
if(!MAX30205_bottom.readTemperature(rawTemp_bottom)){
celsius_bottom = MAX30205_top.toCelsius(rawTemp_bottom);
pc.printf("Bottom Temperature: %d\n\r",celsius_bottom);
} else
pc.printf("Bottom Temperature: Read data failure\n\r");
wait(5);
led = 1; // set LED1 pin to high
wait(2);
led = 0; // set LED1 pin to low
}
after upload the FW to the board , this is the result:
21:45:08.883> Bottom Temperature: Read data failure 21:45:15.958> Top Temperature: 0.000000 21:45:16.022> Bottom Temperature: Read data failure 21:45:23.084> Top Temperature: 0.000000 21:45:23.147> Bottom Temperature: Read data failure 21:45:30.210> Top Temperature: 0.000000 21:45:30.271> Bottom Temperature: Read data failure 21:45:37.334> Top Temperature: 0.000000 21:45:37.397> Bottom Temperature: Read data failure 21:45:44.459> Top Temperature: 0.000000 21:45:44.523> Bottom Temperature: Read data failure 21:45:51.583> Top Temperature: 0.000000 21:45:51.645> Bottom Temperature: Read data failure 21:45:58.711> Top Temperature: 0.000000 21:45:58.770> Bottom Temperature: Read data failure 21:46:05.834> Top Temperature: 0.000000 21:46:05.897> Bottom Temperature: Read data failure 21:46:12.958> Top Temperature: 0.000000 21:46:13.019> Bottom Temperature: Read data failure 21:46:20.082> Top Temperature: 0.000000 21:46:20.146> Bottom Temperature: Read data failure 21:46:27.207> Top Temperature: 0.000000 21:46:27.207> Bottom Temperature: Read data failure 21:46:34.335> Top Temperature: 0.000000 21:46:34.335> Bottom Temperature: Read data failure 21:46:41.458> Top Temperature: 0.000000 21:46:41.458> Bottom Temperature: Read data failure 21:46:48.584> Top Temperature: 0.000000 21:46:48.584> Bottom Temperature: Read data failure 21:46:55.709> Top Temperature: 0.000000 21:46:55.709> Bottom Temperature: Read data failure 21:47:02.772> Top Temperature: 0.000000 21:47:02.833> Bottom Temperature: Read data failure 21:47:09.894> Top Temperature: 0.000000 21:47:09.961> Bottom Temperature: Read data failure 21:47:17.020> Top Temperature: 0.000000 21:47:17.086> Bottom Temperature: Read data failure 21:47:24.145> Top Temperature: 0.000000 21:47:24.234> Bottom Temperature: Read data failure
Also tried to compile with mbed os 2 and I got same results.