i2c_write_raw_blocking does not work

Open
#708 5 comments 0 reactions 1 assignee View on GitHub

@peterharperuk is already working on this.

Since Jul 20, 2024.

Assessment

This issue has not been assessed yet.

Description

hardware_i2c

As extensively discussed at https://forums.raspberrypi.com/viewtopic.php?t=304074 and https://github.com/raspberrypi/pico-examples/issues/192 i2c_write_raw_blocking does not work.

Using just the SDK, the pico cannot operate as a slave (worker) sending bytes to the I2C bus: it can only read. In fact, the i2c_write_raw_blocking function does not appear to block as expected when there is no request from the master (controller). Moreover, even if there is the necessary request from a controller, which is blocking in a corresponding i2c_read_blocking (assuming it's another pico), no data is transmitted on the bus, the controller continues to stay blocked and the worker continues the operations after the i2c_write_raw_blocking.

Accessing the raw registers directly appears to work, as demonstrated by the examples mentioned in the forum post linked above, namely https://github.com/vmilea/pico_i2c_slave and particularly

https://github.com/vmilea/pico_i2c_slave/blob/master/i2c_slave/include/i2c_fifo.h#L29-L33
and
https://github.com/vmilea/pico_i2c_slave/blob/master/i2c_slave/include/i2c_fifo.h#L43-L47

At the very least a comment should be added in the documentation about i2c_write_raw_blocking not working, to keep until it's fixed.

Dominant language
C
Stars
5k
Forks
1.3k
Avg merge
2d 17h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from raspberrypi/pico-sdk

All issues in raspberrypi/pico-sdk

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.