#2483 closed defect (fixed)

raspberrypi: i2c driver can block task forever if compiled with #if I2C_IO_MODE == 1

Reported by: Jan Sommer Owned by: Jan Sommer <soja-lists@…>
Priority: normal Milestone:
Component: bsps Version: 5
Severity: normal Keywords:
Cc: Blocked By:


If the i2c driver is compiled with #if I2C_IO_MODE == 1 it uses a transient event send by an ISR to wait for space in the TX FIFO.

The transient event is sent to the taskid which is stored in the structure for the corresponding bus (bus->task_id).
However, this field is only set once in the rpi_i2c_register_bus-function.
That means if a task other than the one which registered the bus wants to access it, it will block forever because the event is sent to the wrong one (the one which registered the bus).

Attachments (1)

Change History (3)

comment:1 Changed on Dec 2, 2015 at 11:30:42 AM by Jan Sommer

The added patch should fix the problem.
It simply writes the task_id of the current thread to the bus structure before waiting for the transient event. Then, the ISR should send the event to the correct task.

comment:2 Changed on Dec 13, 2015 at 1:22:17 AM by Jan Sommer <soja-lists@…>

Owner: set to Jan Sommer <soja-lists@…>
Resolution: fixed
Status: newclosed

In 687463d7f3b0abb1d98e6e630fb6d47541594bd4/rtems:

Store task_id of the current thread for the ISR before waiting for the transient event

The ISR will send a transient event to the task specified in bus->taskid.
Make sure that the correct task_id is written to this field before waiting
for the transient event to arrive.

Fixes #2483

Note: See TracTickets for help on using tickets.