Hello everyone,
i have a problem reading data from MAX30101 sensor FIFO. I set up the sensor and enable all 3 LEDS (Red, IR, Green), but when I read the data from the FIFO I only get data from the first 3 bytes so only for Red LED, from the other leds I get 0s.
I read the FIFO with a read transaction and store the data to a 9*bytes array. Below is the code I use.
uint8_t slot_temp[9]; //global array
uint8_t max30101_read(uint8_t reg_addr, uint8_t *reg_data)
{
//uint8_t *reg_data;
nrfx_twim_xfer_desc_t desc_read = NRFX_TWIM_XFER_DESC_TXRX(max30101_READ_ADDRS,®_addr,sizeof(reg_addr),reg_data,sizeof(reg_data));
nrfx_err_t twim_xfer_ret = nrfx_twim_xfer(&max30101_twim, &desc_read, 0);
printk("XFER READ return: %2X \n", twim_xfer_ret);
if(twim_xfer_ret!=NRFX_SUCCESS) {
return 0;
}
while (m_xfer_done == false);
return 1;
}
/// inside main :
uint8_t fifo_addr = 0x07;
uint8_t ret = max30101_read(fifo_addr,slot_temp);
I probably do something wrong.
Has anyone encounter the same problem and get all the 3 LEDs data from MAX30101 .
I will appreciate your help. THANK YOU.