This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

TWIM clock pin is pull low after sending zero bytes data.

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

Parents
  • Hi,

    I tested this with an nRF52 DK and an MPU 9255. With this system the slave seems to be holding the SCL line low if I use nrfx_twim_tx(), but send 0 bytes. I'm guessing that the slave is pulling on SCL because it is waiting for a payload after the initial address byte. If I remove the slave the SCL line goes high after every NACKed address byte that I transmit. Does it work okay of you use nrfx_twim_rx(), or transmit at least one byte?

    Can you elaborate on why you need to do it this way?

    Best regards,
    Martin

Reply
  • Hi,

    I tested this with an nRF52 DK and an MPU 9255. With this system the slave seems to be holding the SCL line low if I use nrfx_twim_tx(), but send 0 bytes. I'm guessing that the slave is pulling on SCL because it is waiting for a payload after the initial address byte. If I remove the slave the SCL line goes high after every NACKed address byte that I transmit. Does it work okay of you use nrfx_twim_rx(), or transmit at least one byte?

    Can you elaborate on why you need to do it this way?

    Best regards,
    Martin

Children
No Data
Related