I2C block transaction limitation - 255 bytes max?

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

I2C block transaction limitation - 255 bytes max?

Postby meowsqueak » Tue May 21, 2019 11:59 pm

I'm reading blocks of data from an IC device's internal FIFO over I2C. The device implements special FIFO read registers that "loop around" so that the master can continue to read over and over, allowing large amounts of data to be read in a single I2C transaction.

I'm having a problem with IDF v3.2 where read sizes 256 bytes or greater do not complete correctly. There is no error message and the task does not crash, so I'm not sure what's happening. The first transaction does return data and no error comes from i2c_master_cmd_begin, but after that subsequent transactions return no errors but there's also no data coming back from the interface. I don't have a scope handy at the moment so I can't tell if the slave is actually providing data or not. What I do know is that the slave has data available (it's not a FIFO under-run). I also know that the I2C bus is still working because other registers can still be read correctly.

There's theoretically no limit to how long an I2C transaction can be, provided the slave continues to provide data/acks/nacks. Can anyone shed any light on why the IDF I2C master becomes unhappy over 255 bytes? In the meantime I'll keep looking at my set-up.

EDIT: hold up, I think I know what's going on, and it's my own fault. I'll edit this again if I find the cause.

meowsqueak
Posts: 151
Joined: Thu Jun 15, 2017 4:54 am
Location: New Zealand

Re: I2C block transaction limitation - 255 bytes max?

Postby meowsqueak » Wed May 22, 2019 12:28 am

Ok, never mind, turns out I was passing a uint8_t as the length parameter. Embarrassing.

Sorry for the noise. ESP-IDF happily reads (much) more than 255 bytes per I2C transaction. If you read this far, I apologise for wasting your time.

Who is online

Users browsing this forum: Baidu [Spider], Corand and 113 guests