Linux: Enable i2c kernel tracing

Hi,

when you want to see whats happened on the i2c bus on an raspberry pi you can enable tracing with debugfs.

Get root and mount debugfs. This is usually already mounted in raspbian

1
2
michael@debdev ~ # sudo su
root@debdev ~ # mount -t debugfs none /sys/kernel/debug


Enable tracing

1
2
3
root@debdev ~ # echo nop > /sys/kernel/debug/tracing/current_tracer
root@debdev ~ # echo 1 > /sys/kernel/debug/tracing/events/i2c/enable
root@debdev ~ # echo 1 > /sys/kernel/debug/tracing/tracing_on

Generate some traffic on your i2c bus and view the trace

1
root@debdev ~ # cat /sys/kernel/debug/tracing/trace

To clear the current trace log

1
root@debdev ~ # echo > /sys/kernel/debug/tracing/trace

Michael

Leave a Reply