Hello Khadas Community,
I’m working on a project involving a Khadas VIM4 board and an Xsens MTi-670 Development Kit. My goal is to establish UART communication between the VIM4 and the Xsens device to receive sensor data using the Xsens ROS 2 driver. The Xsens device communicates over UART at a baud rate of 921600. I have connected the Xsens MTi-670 DK to the Khadas VIM4 GPIO header, using the UART_E interface on pins 18 (UART_RX) and 19 (UART_TX) for UART communication, and have connected the grounds between the devices.
Wire the UART Connections:
Xsens Pin 15 (UART_TxD) ➔ Khadas Pin 18 (UART_RX)
Xsens Pin 16 (UART_RxD) ➔ Khadas Pin 19 (UART_TX)
Xsens Pin 2 (GND) ➔ Khadas Pin 9 (GND)
To configure the UART_E interface, I edited the file /boot/dtb/amlogic/kvim4.dtb.overlay.env to include fdt_overlays=uart_e and verified that the uart_e.dtbo file exists in /boot/dtb/amlogic/kvim4.dtb.overlays/. I attempted a UART loopback test by connecting pins 18 and 19 together and used picocom and cat/echo commands to test communication, but no data was echoed back during the tests. I installed ROS 2 and the Xsens ROS 2 driver, compiling the XDA library for ARM64 architecture.
Noticing that the &uart_E node is missing in the decompiled Device Tree Source (kvim4.dts), I created a uart_e.dts file to define and enable the uart_E node. When attempting to compile uart_e.dts to uart_e.dtbo using dtc -I dts -O dtb -o uart_e.dtbo uart_e.dts, I encountered a syntax error: Error: uart_e.dts:13.33-34 syntax error; FATAL ERROR: Unable to parse input tree. I tried including header files in uart_e.dts to define CLKID_UART_E and also replaced CLKID_UART_E with the numeric value 196 in the clocks property, but I’m unsure if this is correct. Despite these attempts, UART_E still did not function after applying the overlay.
/dts-v1/;
/plugin/;
/ {
fragment@0 {
target-path = "/";
__overlay__ {
uart_E: serial@fe080000 {
compatible = "amlogic,meson-axg-uart";
reg = <0x0 0xfe080000 0x0 0x18>;
reg-shift = <2>;
interrupts = <59>;
clocks = <&clkc CLKID_UART_E>;
clock-names = "baud";
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&uart_e_pins>;
};
};
};
fragment@1 {
target = <&pinctrl>;
__overlay__ {
uart_e_pins: uart_e_pins {
mux {
groups = "uart_e_tx", "uart_e_rx";
function = "uart_e";
};
};
};
};
};
I’m uncertain whether GPIOH_4 and GPIOH_5 are correctly assigned to UART_E on the VIM4 and whether these GPIO pins are being used by other functions. I’m also unsure about the correct values for clocks, interrupts, and other properties in the Device Tree Overlay. I have tried testing at different baud rates (115200 and 921600) without success and verified that my user is part of the dialout group for serial port permissions.
I would appreciate guidance on properly defining and enabling the uart_E node in the Device Tree for the Khadas VIM4 and on successfully performing the UART loopback test on UART_E. Specifically, I need assistance with the correct values for clocks, interrupts, and other properties in the DTO; confirmation on whether GPIOH_4 and GPIOH_5 are the correct pins for UART_E on the VIM4; and steps to ensure these GPIO pins are not used by other functions. Any advice on potential pitfalls or required configurations when interfacing the VIM4 with the Xsens MTi-670 DK over UART would also be greatly appreciated.
Thank you in advance for your time and assistance. I’m looking forward to any suggestions or solutions you might offer to help me enable UART_E on the Khadas VIM4 and establish communication with the Xsens MTi-670 DK.