This repository contains a Linux kernel driver for AXI UART Lite over PCIe XDMA. The driver provides a TTY interface for seamless serial communication between the host and FPGA-based designs.
- Supports AXI UART Lite via PCIe XDMA
- Provides a TTY interface (
/dev/ttyUL0) - Supports RX polling for receiving data
- Compatible with Minicom and other serial tools
Ensure you have the necessary kernel headers installed, then run:
makeOnce built, load the kernel module using:
sudo insmod uartlite_xdma.koTo check if the module is loaded:
lsmod | grep uartlite_xdmaAfter loading the module, check if the device is available:
dmesg | grep UARTlite
ls /dev/ttyUL*If the device exists, the driver is properly loaded.
Minicom is a terminal program that allows communication with the UART device.
sudo apt-get install minicomsudo minicom -D /dev/ttyUL0 -D /dev/ttyUL0 specifies the device
Type messages in the terminal, and they will be sent over UART. Any received data will be displayed in the terminal.
Press CTRL + A, then X, and confirm to exit.
In addition to the kernel driver, UARTLite can be accessed directly through PCIe XDMA using a lightweight Python API without the need for a custom kernel module.
This is useful for:
-
Prototyping
-
Debugging
-
Bypassing the kernel for user-space experiments
Features:
-
Direct memory access to UARTLite registers over XDMA
-
Supports byte-by-byte send and receive
-
Supports asyncio for low CPU usage during data reception
-
Works with
/dev/xdma0_userdevice
Key Operations:
-
Reset FIFO at startup
-
Polling UARTLite status register for RX/TX readiness
-
Sending data to TX FIFO
-
Receiving data from RX FIFO
-
Async methods for efficient non-blocking reads
Simple receive loop (synchronous):
if __name__ == "__main__":
uart = XdmaUartLite(device_index=0)
print("Waiting for UARTLite data...")
while True:
data = uart.recv_data(128) # Read 128 bytes
if data:
print(data.decode(errors="ignore").strip())Or async version for optimal CPU usage:
async def main():
uart = XdmaUartLite()
while True:
data = await uart.recv_data_async(128)
print(data.decode(errors="ignore"))
asyncio.run(main())sudo rmmod uartlite_xdmamake cleanKonstantin
This README provides clear instructions for building, testing, and using the driver with Minicom. Let me know if you need any modifications! 🚀