Hey,
I have a custom board with nRF52833. Sensor is connected to:
P0.11 (pin 19) - SCL
P1.08 (pin 17) - SDA
with code below I don't get any `NRF_SUCCESS` back.
void twi_init(void) { const nrfx_twim_config_t twi_config = { .scl = 19, .sda = 17, .frequency = NRF_TWIM_FREQ_100K, .interrupt_priority = APP_IRQ_PRIORITY_HIGH, .hold_bus_uninit = false }; nrfx_err_t err_code = nrfx_twim_init(&m_twi, &twi_config, NULL, NULL); nrfx_twim_enable(&m_twi); } /** * @brief Function for main application entry. */ int main(void) { int detected_device = 0; // nrfx_twim_uninit(&m_twi); APP_ERROR_CHECK(NRF_LOG_INIT(NULL)); NRF_LOG_DEFAULT_BACKENDS_INIT(); NRF_LOG_INFO("TWI scanner started."); NRF_LOG_FLUSH(); twi_init(); for (uint8_t address = 0; address <= TWI_ADDRESSES; address++) { uint8_t sample_data; sample_data = 0x00; nrfx_err_t err_code = nrfx_twim_rx(&m_twi, address, &sample_data, sizeof(sample_data)); if (err_code == NRF_SUCCESS) { NRF_LOG_INFO("TWI device detected at address 0x%x.", address); detected_device = 1; } else{ NRF_LOG_INFO("Nothing at 0x%x.", address); // NRF_LOG_INFO("0x%02x x", address); } NRF_LOG_FLUSH(); nrf_delay_ms(10); } if (!detected_device) { NRF_LOG_INFO("No device was found."); NRF_LOG_FLUSH(); } /* while (true) { }*/ }
I saw here that you must define pins (for eg. P1.08 - PIN 17) as 40 (1x32 + 8).
So I tried with addresses: .scl = 11 and .sda = 40.
I got `NRF_SUCCESS` 2 times (on addresses 0x36 and 0xb6) and got exited, but in datasheet address is shown as 0x57.
I was confused so I unplugged the sensor, run the code again and got the NRF_SUCCESS at same addresses.
I don't know where to go from there.
Sensor is MAX86915, datasheet is not publicly available (I got it via NDA), but datasheet for MAX86916 is almost identical.
Edit: Now I see that if I connect a mini OLED display with i2c to it, even if set to 11 and 40 I don't get any address..
really don't know what is happening.