The crux of the problem is that my Zephyr I2C port is getting locked into EBUSY, and
- What are possible reasons for this
- How do I fix it
Context:
I'm currently trying to port Zephyr onto the Arduino Nano 33 BLE. I2C0, which is connected to the external header pins, works flawlessly, verified by my logic analyzer.
However, when I try to read a register byte using I2C1, I get:
[00:00:04.428,649] <err> i2c_nrfx_twim: Error on I2C line occurred for message 0
And all subsequent I2C1 operations bounce back with -EBUSY.
Files:
Device tree: Device tree file
Arduino BLE schematics: Schematics
Line throwing the error: TWIM line
My Prj.Conf
CONFIG_STDOUT_CONSOLE=y CONFIG_GPIO=y CONFIG_USB=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="UCLA Rocket Project" CONFIG_LOG=y CONFIG_USB_DRIVER_LOG_LEVEL_ERR=y CONFIG_USB_CDC_ACM=y CONFIG_USB_DEVICE_LOG_LEVEL_ERR=y CONFIG_SERIAL=y CONFIG_UART_INTERRUPT_DRIVEN=y CONFIG_UART_LINE_CTRL=y CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" CONFIG_USB_UART_CONSOLE=y CONFIG_CONSOLE_SUBSYS=y CONFIG_CONSOLE_GETLINE=y CONFIG_USB_DEVICE_PID=0x100 CONFIG_USB_DEVICE_VID=0xff12 CONFIG_I2C=y CONFIG_I2C_NRFX=y CONFIG_NRFX_TWIM=y CONFIG_I2C_0=y CONFIG_I2C_1=y
More stuff:
In the source code for the line throwing the error, a comment notes that the error likely arises from a hardware configuration. However, I have no problems using I2C1 in normal Arduino land.
One thing I checked was that it wasn't an issue specific to I2C1. I swapped the pin definitions of I2C1 and I2C0, and now I2C1 works perfectly while I2C0 throws -EBUSY's.
And thats when I decided to beg the internet for help. Thanks in advance!