I’m working on a project trying to implement SDI-12 communication between a sensor and the nRF91 feather board. I am facing an issue configuring the UART data bits for the SDI-12 comms. My setup involves UART2, configured for 1200 baud rate, even parity, and 1 stop bit (using Zephyr’s uart api for config).
I’ve done so far:
- Checked the .dts file for UART2 settings, specifically setting current-speed for 1200 baud.
- In prj.conf, enabled wide data, pipe UART, runtime configuration, and asynchronous UART API.
- When setting uart_cfg.data_bits to UART_CFG_DATA_BITS_7, I receive an error -134 (ENOSYS)
I am able to configure everything else at runtime:
uart_cfg.baudrate = 1200;
uart_cfg.parity = UART_CFG_PARITY_EVEN;
uart_cfg.stop_bits = UART_CFG_STOP_BITS_1;
// uart_cfg.data_bits = UART_CFG_DATA_BITS_7; // does not work
uart_cfg.flow_ctrl = UART_CFG_FLOW_CTRL_NONE;
Before changing the configuration format, the device was successfully talking with another nRF91 feather, I simply need to change the data format to use 7 data bits.
I tried different data bit settings (1 to 9), but all return the same error. Also, the initial UART configure shows: Initial UART config: Baudrate: 1200, Parity: 0, Stop bits: 1, Data bits: 3, Flow control: 0. [3 data bits which seems unconventional].
Any ideas to change the number of data bits transmitted would be greatly appreciated!
Cheers,
Callum