raspberrypi / pico-feedback

25 stars 2 forks source link

Document that 0-byte I2C writes are not possible #120

Open dhalbert opened 3 years ago

dhalbert commented 3 years ago

The I2C hardware used in the RP2040 does not provide for zero-length writes. Such writes are often used for device probing on an I2C bus. A read works for some devices but not all (a read is used in the bus_scan example in pico-examples).

Neither the C/C++ SDK doc nor the RP2040 datasheet document that zero-length writes are not possible. There is a hint in the SDK:

    // Synopsys hw accepts start/stop flags alongside data items in the same
    // FIFO word, so no 0 byte transfers.

I think it would be good to document the limitation in the SDK doc and the datasheet. The datasheet could explain why as well. Thanks.

Ref https://github.com/raspberrypi/pico-sdk/issues/238.

aallan commented 3 years ago

This got discussed elsewhere, extensively, at some point. But I can't remember where. It would be good to consolidate this issue with that one. Anyone remember where we talked about this?

lurch commented 3 years ago

Might have been an internal google-chat discussion? :shrug:

(There's also the SPI-hardware-can't-transfer-multiple-bytes-with-a-single-chipselect-pulse which is similar-but-different to this I2C-hardware-can't-do-0-byte-transfers)

aallan commented 3 years ago

There's also the SPI-hardware-can't-transfer-multiple-bytes-with-a-single-chipselect-pulse which is similar-but-different to this I2C-hardware-can't-do-0-byte-transfers

Maybe that is what I was thinking about.