Hello there.
I am new to Nordic and I want to make MAX30105 sensor to work with my NRF52 DK board (i am using the "nRF5_SDK_15.2.0_9412b96")...
I used the "twi_scanner" example to scan for the sensor and found its address which is 0x75 (which is the correct one judging by the datasheet).
Next I modified the "twi_sensor" example to try with lighting the green led of the sensor as a start.
Here is the modified main function:
int main(void) { APP_ERROR_CHECK(NRF_LOG_INIT(NULL)); NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_LOG_INFO("\r\nTWI sensor example started."); NRF_LOG_FLUSH(); twi_init(); NRF_LOG_INFO("\r\nTWI init finished."); NRF_LOG_FLUSH(); MAX30105_set_mode(); NRF_LOG_INFO("\r\nMAX30105 set mode finished."); NRF_LOG_FLUSH(); while (true) { nrf_delay_ms(500); do { __WFE(); }while (m_xfer_done == false); read_sensor_data(); NRF_LOG_FLUSH(); } }
Here is the modified LM75B_set_mode function which i renamed to be MAX30105_set_mode now:
void MAX30105_set_mode(void) { ret_code_t err_code; /* Writing to LM75B_REG_CONF "0" set temperature sensor in NORMAL mode. */ uint8_t reg[2] = {0x0EU, 0x7FU}; err_code = nrf_drv_twi_tx(&m_twi, 0x75U, reg, sizeof(reg), false); APP_ERROR_CHECK(err_code); while (m_xfer_done == false); NRF_LOG_INFO("\r\ntest"); NRF_LOG_FLUSH(); }
"0x0E" is the register for the green led amplitude and "0x7F" is the value to set the led current to 25.4mA.
I didn't modify anything else.
What i get in the serial is this:
"<info> app:
TWI sensor example started.
<info> app:
TWI init finished."
It seems like "m_xfer_done" never becomes "true", with other words the transmission of the configuration i want to send never finishes.
Any help will be greatly appreciated. Thanks in advance.