Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8037

SDK • Re: I2C random timeouts using i2c_write_timeout_us()

$
0
0
So for the benefit of others, the relevant error values for the two functions are -1 or -2, from the C SDK:

Code:

enum pico_error_codes { PICO_OK = 0, PICO_ERROR_NONE = 0, PICO_ERROR_GENERIC = -1, PICO_ERROR_TIMEOUT = -2, etc
So a timeout error. Nice scope pix but no mention of the device at the other end. I can look up the address of course, but it could be anything, really. Strange why you'd want to run that something at 20 kHz. Pieces of the puzzle are missing, so what we can offer is mostly guesswork and opinions.

Could be a lot of things... if you are holding the board with your hand, the moving loose-ish wiring can easily spoil your day. Or missing pull-up resistors, or pull-ups sized for 5V operation can also cause problems. Could be whatever the device is on the other end.

[Edit] Or disable all pulls at the pins and see if it gets better.

Statistics: Posted by katak255 — Fri Jan 10, 2025 1:24 am



Viewing all articles
Browse latest Browse all 8037

Trending Articles