Dear Nordic
I found a example using nrfx_twim_rx() to scan slaves, I was just wondering if I can use nrfx_twim_tx() to scan slave devices by send zero byte data? I use nrfx_twim_tx() to send zero byte data to MCP23017 device, I don't got error code, but I don't receive TWIM event too. I found the SCL pin is pull low, I removed MCP23017 but the SCL pin is still low.
I think the hardware not support to send zero byte data, if we send zero byte, SCL clock will be pull down waiting for data to be sent, is it right?
uint8_t HAL_I2C_End_Transmission(HAL_I2C_Interface i2c, uint8_t stop,void* reserved)
{
HAL_I2C_Acquire(i2c, NULL);
uint32_t err_code;
m_i2c_map[i2c].transmitting = true;
err_code = nrfx_twim_tx(m_i2c_map[i2c].instance, m_i2c_map[i2c].address, m_i2c_map[i2c].tx_buf,
m_i2c_map[i2c].tx_buf_length, true); // !stop
if (err_code)
{
m_i2c_map[i2c].transmitting = false;
}
while (m_i2c_map[i2c].transmitting);
m_i2c_map[i2c].tx_buf_index = 0;
m_i2c_map[i2c].tx_buf_length = 0;
HAL_I2C_Release(i2c, NULL);
return 0;
}
Best Regards,
Eugene