I'm having 3 issues with I2C:
A) It keeps returning -5 (-EIO), failed to write to I2C device..., however I do sometimes see the byte going out so I'm not sure why it always fails even when I can see it being transmitted.
B) The function i2c_write_dt keeps doing different things each time:
temp_byte = 0xff; ret = i2c_write_dt(&dev_i2c, &temp_byte, 1);
Most of the time it does 2 back-to-back low pulses on SDA whilte SCL remains high, sometimes the SDA line remains low afterwards.
On rare occasions the byte is sent and it looks perfect from what I can tell.
Every now and then it looks like it is sending the byte but SCL remains high the whole time.
C) When I call i2c_write_dt from an interrupt twice (void button_pressed(... and I press the button twice), the program seems to just crash and nothing else happens, I have to hit reset and it works again. I probably made a mistake calling that from an interrupt however it's a little bit worrisome that something so trivial causes the program to stop working. Is Zephyr / nRF Connect SDK prone to crashing / hanging?
At this point I'm going through DevAcademy because I've never used Zephyr before so I'm trying to learn it. I'm used to working directly with the hardware so this Zephyr thing is like inserting a black box between me and the hardware, most of the time I have no idea what's going on, I really hope that will change as I get better with it.