Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
0
answers
27
views
Performance and Data Loss Issues with MSI on AXI UART16550
I am experiencing significant performance and data loss issue with the AXI UART16550 on our Xilinx FPGA. Initially, the device operated without any problems using legacy interrupts. However, after switching to Message Signaled Interrupts (MSI), I began to encounter severe performance degradation. Sp...
I am experiencing significant performance and data loss issue with the AXI UART16550 on our Xilinx FPGA. Initially, the device operated without any problems using legacy interrupts. However, after switching to Message Signaled Interrupts (MSI), I began to encounter severe performance degradation. Specifically, the CPU usage spikes to 100% when using the UART device, and we are losing data during high-speed transmissions.
The FPGA is configured to use MSI, and the MSI is correctly assigned in the PCI configuration space. We are using a custom serial8250-based driver in Linux, and the FIFO settings have been adjusted to minimize RX buffer overflow. Despite these optimizations, the problem persists. Testing with legacy interrupts shows that the device operates correctly without data loss or high CPU usage.
Could you please provide guidance on the recommended settings for MSI when using AXI UART16550? Are there any known limitations or specific configurations required for reliable MSI operation in this context? Additionally, should any modifications be made at the FPGA configuration level, such as PCIe IP core settings, to improve MSI performance?
If you require further information, including code snippets, register configurations, or test results, please let me know. I would greatly appreciate your assistance in resolving this issue.
Thank you for your support.
Best regards.
FPGA: xc7k160tfbg676-2L
Vivado versiyon: 2018.3
PCIe IP: AXI Memory Mapped to PCI Express (2.9)
UART: AXI UART16550 (2.0)
Driver: Serial8250
Hamit Can Karaca
(1 rep)
May 12, 2025, 06:14 AM
2
votes
0
answers
49
views
Serial issue on Beaglebone Black running linux
For a project we are using Modbus which runs over a RS485 interface. Around 95% of the messages are correctly send by the client, after which the server responds correctly. However, once every few hundred messages the server does not respond, resulting in a timeout. After digging deeper into why the...
For a project we are using Modbus which runs over a RS485 interface. Around 95% of the messages are correctly send by the client, after which the server responds correctly. However, once every few hundred messages the server does not respond, resulting in a timeout.
After digging deeper into why the server does not respond, it seems that the server either gets a wrong modbus id, which it should not respond to, or the CRC byte is incorrect. The RS485 signal was also shown on an osciloscope which showed that the server interpreted that data correctly, thus the client was sending the wrong data.
To see whether the client was indeed sending the data that is expected, some test code was written:
The second error which occurs is the opposite of the first error, where the id byte is not transmitted and the message seems to start with sending the function. Transmitting a complete random CRC byte.
In both cases libmodubs seems to try to transmit the right buffers. This is checked by intercepting the write call libmodbus uses to write to the uart peripheral in linux. This shows the correct bytes which should have been sent, but the signal on the scope seems to show that the buffer sent is not correctly written to the uart device.
How can I resolve this problem, or how I can debug this problem any further?
System specs:
Client: Beaglebone black industrial running linux
Server: STM32F103
#include
#include
#include
#include
#include "macrologger.h"
modbus_t *context = nullptr;
// Define the function pointer type for the original write function
typedef ssize_t (*write_t)(int, const void *, size_t);
// The wrapper for the write function
ssize_t write(int fd, const void *buf, size_t count) {
// Log data being written
printf("Intercepted write call: ");
for (size_t i = 0; i < count; i++) {
printf("{%02X}", ((unsigned char *)buf)[i]);
}
printf("\n");
// Use dlsym to get the original write function
write_t real_write = (write_t) dlsym(RTLD_NEXT, "write");
// Check for errors in dlsym
if (!real_write) {
fprintf(stderr, "Error: %s\n", dlerror());
return -1; // Return an error code if dlsym fails
}
// Call the original write function
return real_write(fd, buf, count);
}
uint32_t modbus_errors = 0;
uint8_t id = 0;
void setModbusSlaveId() {
// Set Modbus slave ID
if (modbus_set_slave(context, id++) < 0) {
LOG_ERROR("modbus set slave error: %s", modbus_strerror(errno));
}
}
void sendTest() {
uint16_t state;
for (uint32_t index = 0; index < 100; index++) {
printf("Sending message with slave ID: %d\n", modbus_get_slave(context));
setModbusSlaveId();
int reply = modbus_read_registers(context, 0x12, 1, &state);
if (reply == -1) {
modbus_errors++;
while (1);
}
}
}
int main() {
LOG_INFO("Starting libmodbus_test");
context = modbus_new_rtu("/dev/rs485-2", 115200, 'N', 8, 1);
if (context == nullptr) {
LOG_ERROR("Unable to create the libmodbus context");
return 0;
}
// Set response timeout
modbus_set_response_timeout(context, 2, 0);
if (modbus_rtu_set_rts(context, MODBUS_RTU_RTS_UP) < 0) {
LOG_ERROR("Unable to set modbus rtu rts mode");
return 0;
}
if (modbus_rtu_set_rts_delay(context, 200) < 0) {
LOG_ERROR("Unable to set modbus rtu rts delay");
return 0;
}
LOG_INFO("modbus rts: %i, current rts delay: %i us",
modbus_rtu_get_rts(context), modbus_rtu_get_rts_delay(context));
if (modbus_set_debug(context, false) < 0) {
LOG_ERROR("modbus set debug error");
return 0; // Not fatal, continue
}
if (modbus_connect(context) < 0) {
LOG_ERROR("modbus connect error");
return 0;
}
while (1) {
sendTest();
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
This codes initializes the libmodbus library and opens the modbus connection on RS485-2 at 115200 baud. It sends bursts of a 100 messages every 100ms. The slave id is incremented every message to show where the error occurs, after which the program halts (while (1)). The server is setup to ignore the slave id, thus it responds to every message it receives.
The expected modbus command is: {id}{03}{00}{12}{01}{CRCH}{CRCL}
From this test 2 errors where noted after the program halted.
Firstly it seems that sometimes the slave id of the previous message first sent, after which the correct message follows. This however clips off the CRC byte causing an incorrect CRC error.




user3679572
(21 rep)
Feb 4, 2025, 11:37 AM
• Last activity: Feb 4, 2025, 07:23 PM
0
votes
1
answers
200
views
Writing additional kernel layer on UART driver
I want to take leverage the existing kernel API/module to create packet layer abstraction for user space application to transfer "packets" via UART interface. So, the intention is a kernel module that does the following 1) Uses different module to read UART bytes (I'm not sure what I should use, I c...
I want to take leverage the existing kernel API/module to create packet layer abstraction for user space application to transfer "packets" via UART interface.
So, the intention is a kernel module that does the following
1) Uses different module to read UART bytes (I'm not sure what I should use, I can see "usbserial" available, but not sure if it can be extended that way)
2) After reading a certain number of bytes do some calculation on in, like crc, type etc. And then transfers the packet to the user space program
3) User space program can use poll mechanism to get notified, and then read the entire packet.
How can I build such a thing? I'm having trouble connecting the pieces, and google/chatgpt is not helping. Any example that does something similar would be awesome, thanks!
edit:
As a packet I'm referring to an internal data structure, nothing to do with any networking protocol, it's literally.
struct comms_packet {
uint8_t length;
uint8_t type;
uint8_t data[PACKET_DATA_LEN];
uint8_t crc; };
konradk
(1 rep)
Nov 6, 2024, 09:01 PM
• Last activity: Nov 7, 2024, 05:16 PM
8
votes
1
answers
1101
views
How to enable the second console to a FreeBSD guest running in bhyve?
# Background I'm running FreeBSD 12.1-RELEASE as a host for [bhyve](https://www.freebsd.org/cgi/man.cgi?bhyve) virtual machines. I have a FreeBSD 12.1-RELEASE guest running inside a VM. I would like to have two TTY-class devices configured for it. According to the manual page, in order to start the...
# Background
I'm running FreeBSD 12.1-RELEASE as a host for [bhyve](https://www.freebsd.org/cgi/man.cgi?bhyve) virtual machines.
I have a FreeBSD 12.1-RELEASE guest running inside a VM. I would like to have two TTY-class devices configured for it.
According to the manual page, in order to start the VM with two TTY-class devices I have to start bhyve with command-line options similar to those:
-l com1,/dev/nmdm0B -l com2,/dev/nmdm1B
. Then I should be able to connect to the guest via those two [nullmodem terminals](https://www.freebsd.org/cgi/man.cgi?nmdm) with cu -l /dev/nmdm0A
and cu -l /dev/nmdm1A
.
# Problem
The first command works as expected: cu -l /dev/nmdm0A
shows me the main console of the guest.
The second command, however, attaches to the guest, but shows nothing. I would expect to show me a login prompt as if switched to another TTY.
*What am I missing?*
---
## Additional details
- The guest is a fresh installation of FreeBSD.
- The output of dmesg | grep uart
on the guest is as follows:
uart0: port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
uart0: console (115200,n,8,1)
uart1: port 0x2f8-0x2ff irq 3 on acpi0
- I've tried setting hint.uart.1.flags
first to 0x10
and then to 0x80
(although this one is for kernel debuggers from what I understand from [uart(4)](https://www.freebsd.org/cgi/man.cgi?uart)) and rebooted after each change. It didn't work.
### References
- https://bsdjhb.blogspot.com/2018/10/using-bhyve-for-freebsd-development.html
- https://gist.github.com/landonf/d00a15ede7d5ccb0e371
Mateusz Piotrowski
(4983 rep)
Jun 26, 2020, 03:39 PM
• Last activity: Oct 1, 2024, 11:44 AM
2
votes
1
answers
78
views
How to mirror serial output ttyS0 to the HDMI /dev/dri/card0?
When I starting my single board computer, I can face the output from the `UART`, or even called `/dev/ttyS0`. I want to mirror everything to my `HDMI` port which is placed on `/dev/dri/card0`. How can I achieve that? Here I'm running the command `drm_info`. I'm using Ubuntu 24.04 LTS. >> drm_info [?...
When I starting my single board computer, I can face the output from the
UART
, or even called /dev/ttyS0
. I want to mirror everything to my HDMI
port which is placed on /dev/dri/card0
.
How can I achieve that? Here I'm running the command drm_info
. I'm using Ubuntu 24.04 LTS.
>> drm_info
[?2004l
Node: /dev/dri/card0
├───Driver: stm (STMicroelectronics SoC DRM) version 1.0.0 (20170330)
│ ├───DRM_CLIENT_CAP_STEREO_3D supported
│ ├───DRM_CLIENT_CAP_UNIVERSAL_PLANES supported
│ ├───DRM_CLIENT_CAP_ATOMIC supported
│ ├───DRM_CLIENT_CAP_ASPECT_RATIO supported
│ ├───DRM_CLIENT_CAP_WRITEBACK_CONNECTORS supported
│ ├───DRM_CAP_DUMB_BUFFER = 1
│ ├───DRM_CAP_VBLANK_HIGH_CRTC = 1
│ ├───DRM_CAP_DUMB_PREFERRED_DEPTH = 0
│ ├───DRM_CAP_DUMB_PREFER_SHADOW = 0
│ ├───DRM_CAP_PRIME = 3
│ ├───DRM_CAP_TIMESTAMP_MONOTONIC = 1
│ ├───DRM_CAP_ASYNC_PAGE_FLIP = 0
│ ├───DRM_CAP_CURSOR_WIDTH = 64
│ ├───DRM_CAP_CURSOR_HEIGHT = 64
│ ├───DRM_CAP_ADDFB2_MODIFIERS = 1
│ ├───DRM_CAP_PAGE_FLIP_TARGET = 0
│ ├───DRM_CAP_CRTC_IN_VBLANK_EVENT = 1
│ ├───DRM_CAP_SYNCOBJ = 0
│ └───DRM_CAP_SYNCOBJ_TIMELINE = 0
├───Device: platform st,stm32-ltdc
│ └───Available nodes: primary
├───Framebuffer size
│ ├───Width: [0, 2048]
│ └───Height: [0, 2048]
├───Connectors
│ └───Connector 0
│ ├───Object ID: 32
│ ├───Type: HDMI-A
│ ├───Status: connected
│ ├───Physical size: 1210x680 mm
│ ├───Subpixel: unknown
│ ├───Encoders: {0}
│ ├───Modes
│ │ ├───1920x1080@30.00 driver phsync pvsync 16:9
│ │ ├───1920x1080@25.00 driver phsync pvsync 16:9
│ │ ├───1920x1080@24.00 driver phsync pvsync 16:9
│ │ ├───1280x720@60.00 driver phsync pvsync
│ │ ├───1280x720@60.00 driver phsync pvsync 16:9
│ │ ├───1280x720@50.00 driver phsync pvsync 16:9
│ │ ├───720x576@50.00 driver nhsync nvsync 16:9
│ │ ├───720x576@50.00 driver nhsync nvsync 4:3
│ │ ├───720x480@59.94 driver nhsync nvsync 16:9
│ │ └───720x480@59.94 driver nhsync nvsync 4:3
│ └───Properties
│ ├───"EDID" (immutable): blob = 44
│ ├───"DPMS": enum {On, Standby, Suspend, Off} = On
│ ├───"link-status": enum {Good, Bad} = Good
│ ├───"non-desktop" (immutable): range [0, 1] = 0
│ ├───"TILE" (immutable): blob = 0
│ ├───"CRTC_ID" (atomic): object CRTC = 0
│ └───"dithering": enum {Off, On} = Off
├───Encoders
│ └───Encoder 0
│ ├───Object ID: 31
│ ├───Type: DPI
│ ├───CRTCS: {0}
│ └───Clones: {0}
├───CRTCs
│ └───CRTC 0
│ ├───Object ID: 38
│ ├───Legacy info
│ │ └───Gamma size: 256
│ └───Properties
│ ├───"ACTIVE" (atomic): range [0, 1] = 0
│ ├───"MODE_ID" (atomic): blob = 0
│ ├───"OUT_FENCE_PTR" (atomic): range [0, UINT64_MAX] = 0
│ ├───"VRR_ENABLED": range [0, 1] = 0
│ ├───"GAMMA_LUT": blob = 0
│ └───"GAMMA_LUT_SIZE" (immutable): range [0, UINT32_MAX] = 256
└───Planes
├───Plane 0
│ ├───Object ID: 34
│ ├───CRTCs: {0}
│ ├───Legacy info
│ │ ├───FB ID: 0
│ │ └───Formats:
│ │ ├───ARGB8888 (0x34325241)
│ │ ├───XRGB8888 (0x34325258)
│ │ ├───RGB888 (0x34324752)
│ │ ├───RGB565 (0x36314752)
│ │ ├───ARGB1555 (0x35315241)
│ │ ├───XRGB1555 (0x35315258)
│ │ ├───ARGB4444 (0x32315241)
│ │ ├───XRGB4444 (0x32315258)
│ │ └───C8 (0x20203843)
│ └───Properties
│ ├───"type" (immutable): enum {Overlay, Primary, Cursor} = Primary
│ ├───"FB_ID" (atomic): object framebuffer = 0
│ ├───"IN_FENCE_FD" (atomic): srange [-1, INT32_MAX] = -1
│ ├───"CRTC_ID" (atomic): object CRTC = 0
│ ├───"CRTC_X" (atomic): srange [INT32_MIN, INT32_MAX] = 0
│ ├───"CRTC_Y" (atomic): srange [INT32_MIN, INT32_MAX] = 0
│ ├───"CRTC_W" (atomic): range [0, INT32_MAX] = 0
│ ├───"CRTC_H" (atomic): range [0, INT32_MAX] = 0
│ ├───"SRC_X" (atomic): range [0, UINT32_MAX] = 0
│ ├───"SRC_Y" (atomic): range [0, UINT32_MAX] = 0
│ ├───"SRC_W" (atomic): range [0, UINT32_MAX] = 0
│ ├───"SRC_H" (atomic): range [0, UINT32_MAX] = 0
│ ├───"IN_FORMATS" (immutable): blob = 35
│ │ └───DRM_FORMAT_MOD_LINEAR (0x0)
│ │ ├───ARGB8888 (0x34325241)
│ │ ├───XRGB8888 (0x34325258)
│ │ ├───RGB888 (0x34324752)
│ │ ├───RGB565 (0x36314752)
│ │ ├───ARGB1555 (0x35315241)
│ │ ├───XRGB1555 (0x35315258)
│ │ ├───ARGB4444 (0x32315241)
│ │ ├───XRGB4444 (0x32315258)
│ │ └───C8 (0x20203843)
│ ├───"alpha": range [0, UINT16_MAX] = 65535
│ └───"zpos" (immutable): range [0, 0] = 0
└───Plane 1
├───Object ID: 39
├───CRTCs: {0}
├───Legacy info
│ ├───FB ID: 0
│ └───Formats:
│ ├───ARGB8888 (0x34325241)
│ ├───RGB888 (0x34324752)
│ ├───RGB565 (0x36314752)
│ ├───ARGB1555 (0x35315241)
│ ├───ARGB4444 (0x32315241)
│ └───C8 (0x20203843)
└───Properties
├───"type" (immutable): enum {Overlay, Primary, Cursor} = Overlay
├───"FB_ID" (atomic): object framebuffer = 0
├───"IN_FENCE_FD" (atomic): srange [-1, INT32_MAX] = -1
├───"CRTC_ID" (atomic): object CRTC = 0
├───"CRTC_X" (atomic): srange [INT32_MIN, INT32_MAX] = 0
├───"CRTC_Y" (atomic): srange [INT32_MIN, INT32_MAX] = 0
├───"CRTC_W" (atomic): range [0, INT32_MAX] = 0
├───"CRTC_H" (atomic): range [0, INT32_MAX] = 0
├───"SRC_X" (atomic): range [0, UINT32_MAX] = 0
├───"SRC_Y" (atomic): range [0, UINT32_MAX] = 0
├───"SRC_W" (atomic): range [0, UINT32_MAX] = 0
├───"SRC_H" (atomic): range [0, UINT32_MAX] = 0
├───"IN_FORMATS" (immutable): blob = 40
│ └───DRM_FORMAT_MOD_LINEAR (0x0)
│ ├───ARGB8888 (0x34325241)
│ ├───RGB888 (0x34324752)
│ ├───RGB565 (0x36314752)
│ ├───ARGB1555 (0x35315241)
│ ├───ARGB4444 (0x32315241)
│ └───C8 (0x20203843)
├───"alpha": range [0, UINT16_MAX] = 65535
└───"zpos" (immutable): range [1, 1] = 1
[?2004hroot@stm32-os:~#
euraad
(219 rep)
Sep 30, 2024, 09:32 PM
• Last activity: Oct 1, 2024, 05:46 AM
1
votes
1
answers
2964
views
Debian not recognizing my ttyS0 / console redirection not working
I have a fitlet2 (https://fit-iot.com/web/products/fitlet2/) which has a serial port. I can connect to the serial port of the fitlet2 with screen from my computer (screen /dev/ttyUSB0 115200) and access the BIOS, after I have enabled the "Serial Port Console Redirection" in the BIOS. I am also able...
I have a fitlet2 (https://fit-iot.com/web/products/fitlet2/) which has a serial port. I can connect to the serial port of the fitlet2 with screen from my computer (screen /dev/ttyUSB0 115200) and access the BIOS, after I have enabled the "Serial Port Console Redirection" in the BIOS.
I am also able to access the GRUB Bootloader over serial. Access over serial works in various GRUB bootloaders (debian/ubuntu installer, debian installed). But whenever the system is loaded, I can no more access the serial port which I was using.
I tried to activate console redirection in GRUB for the system by editing the boot parameters according to this post https://www.cyberciti.biz/faq/howto-setup-serial-console-on-debian-linux/ . Soon I realized that my ttyS0 is somehow not working correctly. Starting to debug my physical serial interfaces I just couldn't find a way to get this to work.
Setserial tells me the following:
/dev/ttyS0, UART: 16550A, Port: 0x0000, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x0000, IRQ: 5
/dev/ttyS2, UART: 16550A, Port: 0x0000, IRQ: 7
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3
dmesg | grep tty this:
[ 0.000000] Command line: BOOT_IMAGE=/vmlinuz-4.9.0-8-amd64 root=/dev/mapper/pen--01--vg-root ro console=ttyS0,115200n8 console=tty0,115200n8
[ 0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-4.9.0-8-amd64 root=/dev/mapper/pen--01--vg-root ro console=ttyS0,115200n8 console=tty0,115200n8
[ 0.000000] console [tty0] enabled
[ 0.000000] console [ttyS0] enabled
[ 49.308213] console [ttyS0] disabled
[ 49.312635] dw-apb-uart.0: ttyS0 at MMIO 0x81424000 (irq = 4, base_baud = 115200) is a 16550A
[ 49.407713] usb 1-8.2: Qualcomm USB modem converter now attached to ttyUSB0
[ 49.410489] usb 1-8.2: Qualcomm USB modem converter now attached to ttyUSB1
[ 49.411349] usb 1-8.2: Qualcomm USB modem converter now attached to ttyUSB2
[ 53.577143] console [ttyS0] enabled
[ 54.744793] dw-apb-uart.1: ttyS1 at MMIO 0x81422000 (irq = 5, base_baud = 115200) is a 16550A
[ 54.755771] dw-apb-uart.2: ttyS2 at MMIO 0x81420000 (irq = 7, base_baud = 115200) is a 16550A
[ 115.902885] ttyS2 - failed to request DMA
Why is ttyS0 disabled and again reenabled? How can I enable it/use it properly?
How can I get my login shell on serial? What am I missing?
user10550633
(11 rep)
Oct 26, 2018, 01:09 PM
• Last activity: Aug 18, 2024, 01:02 PM
0
votes
1
answers
159
views
How to get root-Access and/or update/extract firmware via UART
I would like to try to equip my non-specific China-Wall-Brick-WiFi-Router with root access and update it if necessary. Here is a sample image of the device: [![Device][1]][1] **The problem is:** The device has no official manufacturer, it is a noname China device. Accordingly, there is no manufactur...
I would like to try to equip my non-specific China-Wall-Brick-WiFi-Router with root access and update it if necessary.
Here is a sample image of the device:
**The problem is:** The device has no official manufacturer, it is a noname China device. Accordingly, there is no manufacturer's website, nor are there any updates or downloads of the firmware.
Serial control via **UART** generates a shell output. Here it is theoretically possible to log on to the existing Linux system. The problem is that there is no access data. Trying standard access data such as

root:root
, root:admin
, admin:admin
or similar does not work.
The system has a modified version of OpenWRT (version OpenWrt Linux-3.10.14-p112871
) and is booted with U-Boot 1.1.3 (Dec 25 2017 - 22:59:38)
.
I haven't had any experience with U-Boot yet, but it seems to be a slimmed down and limited version, as I only get very few commands displayed in the help in the U-Boot shell:
MT7628 # help
? - alias for 'help'
bootm - boot application image from memory
cp - memory copy
erase - erase SPI FLASH memory
go - start application at address 'addr'
help - print online help
loadb - load binary file over serial line (kermit mode)
md - memory display
mdio - Ralink PHY register R/W command !!
mm - memory modify (auto-incrementing)
nm - memory modify (constant address)
printenv- print environment variables
reset - Perform RESET of the CPU
rf - read/write rf register
saveenv - save environment variables to persistent storage
setenv - set environment variables
spi - spi command
tftpboot- boot image via network using TFTP protocol
version - print monitor version
MT7628 # printenv
bootcmd=tftp
bootdelay=5
baudrate=57600
ethaddr="00:AA:BB:CC:DD:10"
ipaddr=10.10.10.123
serverip=10.10.10.3
stdin=serial
stdout=serial
stderr=serial
BootType=3
Environment size: 160/4092 bytes
How can I gain full root access to the device without damaging the current firmware?
I would prefer it if I could back up the complete firmware image in some way beforehand so that I can restore it in case of doubt. What is the best way to do this via U-Boot?
Are there perhaps bruteforce programs that connect via COM port (UART)? This would certainly also be a way of finding out the root password.
Adrian Preuss
(101 rep)
Jul 6, 2024, 09:24 AM
• Last activity: Jul 6, 2024, 11:40 AM
0
votes
1
answers
1364
views
Armbian enable UART2 for TX/RX
I'm trying to use the `UART1` and `UART2` of my device (a NanoPi NEO) to read serial data. So far, `UART1` i fully functionnal and I can read and transmit data through `/dev/ttyS1`. I've enabled `UART2` using the `armbian-config` hardware menu and it seems to have added the line in the `armbianEnv.t...
I'm trying to use the
UART1
and UART2
of my device (a NanoPi NEO) to read serial data.
So far, UART1
i fully functionnal and I can read and transmit data through /dev/ttyS1
.
I've enabled UART2
using the armbian-config
hardware menu and it seems to have added the line in the armbianEnv.txt
:
# cat /boot/armbianEnv.txt
verbosity=1
bootlogo=false
console=serial
disp_mode=1920x1080p60
overlay_prefix=sun8i-h3
overlays=uart1 uart2 uart3
rootdev=UUID=f8644502-8a67-43df-8275-2953e5ef9c87
rootfstype=ext4
usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u
The config does not seem to be the same for the two UARTs:
# cat /proc/tty/driver/serial
serinfo:1.0 driver revision:
0: uart:U6_16550A mmio:0x01C28000 irq:137 tx:19080 rx:134 RTS|DTR
1: uart:U6_16550A mmio:0x01C28400 irq:138 tx:0 rx:4312 RTS|CTS|DTR
2: uart:U6_16550A mmio:0x01C28800 irq:139 tx:0 rx:0 CTS
3: uart:U6_16550A mmio:0x01C28C00 irq:140 tx:0 rx:0 RTS|CTS|DTR
4: uart:unknown port:00000000 irq:0
5: uart:unknown port:00000000 irq:0
6: uart:unknown port:00000000 irq:0
7: uart:unknown port:00000000 irq:0
Did I make something wrong or forget to run a command to enable UART2
through /dev/ttyS2
?
I've also tried to add the following line to armbianEnv.txt
but didn't help: param_uart2_rtscts=1
IArchi
(11 rep)
Feb 8, 2024, 11:09 AM
• Last activity: May 1, 2024, 04:46 PM
0
votes
1
answers
54
views
RS232 (FT232R) - Different TX voltages with the same adapter under Windows and Linux
I have a USB to RS232 adapter cable (FT232R) that I use with Windows and Linux. Therefore I use a Python script with pyserial. Under Windows, the lowest voltage during a data transfer is -6.2V and the highest voltage is 6.2V on the TX line. Communication with a connected device works perfectly here....
I have a USB to RS232 adapter cable (FT232R) that I use with Windows and Linux. Therefore I use a Python script with pyserial.
Under Windows, the lowest voltage during a data transfer is -6.2V and the highest voltage is 6.2V on the TX line. Communication with a connected device works perfectly here.
Under Linux I send exactly the same data (same python code), but the TX voltage is shifted upwards. The lowest voltage is -0.8V and the highest voltage is 11.8V. The communication fails here. When I measure over a 10k resistor the voltage is positive at the beginning and drops during transmission under Linux (see images).
How can I adjust the voltage under Linux (Ubuntu)?
The adapter cable is from W&T (https://wut.de/e-38011-ww-dade-000.php) . Under Linux the adapter is recognized as "Ltd FT232 Serial (UART) IC".
Images can be found here: https://imgur.com/a/lB78S4a
FHG
(1 rep)
Apr 24, 2024, 02:03 PM
• Last activity: Apr 24, 2024, 07:55 PM
2
votes
0
answers
3676
views
Samsung SMT-G7401 hack
#Samsung SMT-G7401 hack# ##introduction## I have an SMT-G7401_PCS01B (Horizon box) from UPC Switzerland and I would like to install debian or multimedia linux distribution on it if is it possible, if is it not possible I just take the hdd for my PC. (I have recently received the "UPC TV Box") ##Poss...
#Samsung SMT-G7401 hack#
##introduction##
I have an SMT-G7401_PCS01B (Horizon box) from UPC Switzerland and I would like to install debian or multimedia linux distribution on it if is it possible, if is it not possible I just take the hdd for my PC. (I have recently received the "UPC TV Box")
##Possible and not possible way##
- I can get log from the UART interface with an "FTDI FT232RL" + "minicom". I have the serial console but I can't do anything.
UART pinout
POST: 0xb03
wdt: reset type = 0, reset reason = 0
POST: 0xc02
cefdk_rom_base_addr: 0x00280800
POST: 0xc1f
wdt: acboot win2 end, counter=981466
POST: 0xf02
Warning: No device found in chip select 0
Spi Flash Init Failed and disable SPI Fl
Intel(R) Consumer Electronics Firmware Development Kit (Intel(R) CEFDK)
Copyright (C) 1999-2012 Intel Corporation. All rights reserved.
Build Time (04/17/14 19:20:25).
POST: 0xf05Loading 8051_fw from MFH...
POST: 0xf07
Set flash layout to Samsung 128MB layout
POST: 0xf18
---memory initialization for postbox communication -----
POST: 0xf19
Waiting for 5 sec for DOCSIS PLL1 ready...
DOCSIS PLL1 ready
POST: 0xfa0
SMM: Ok
POST: 0xf24
ACPI Init: finished with table region from 00011ab0 to 00018000
acpi: Created tables at 00011ab0-00018000
POST: 0xf29
HW Revision : 12
CEFDK Version : CE2600 build (SMP enabled)
8051 Firmware : A0-1.2.0 build R 0x20A
8051 FW I/O Module :
Silicon Stepping : B2
Silicon SKU : 0x037
Board Set As : Harbor Park - MG
CPU Threads : 2
CPU Multiplier : 12
CPU Bus Speed : 100 MHz
Memory Size : 512 MB
Memory Type & Speed : x16 DDR3-1333 (10-10-10)
Trusted Boot : Untrusted
Boot Mode : eMMC-NAND (STRAPS)
Registered net controller: e1000
Init External Switch for board Type: 1
Timing data c003
Timing data c03e
ESWITCH ID 1761
1000M FD Link is ready!
Configure IP via static IP.
Mac address is : 54:FA:3E:2F:3C:E3
Host IP address is: 192.168.192.1
Subnet Mask is : 255.255.255.0
Gateway address is: 192.168.192.1
================================================
WARNING:
Please make sure the board type and DOCSIS DDR offset/size are set correctly,
otherwise DOCSIS subsystem won't boot!
If not sure, please use "settings" shell command to show the setup menu,
then check "Advanced Features".
================================================
Press 'Enter' within 0 seconds to disable automatic boot.
Hit a key to start the shell...
**********************************************************
***** Uboot is not upgraded --- boot kernel *****
**********************************************************
Running auto script...
shell> load -m 0x200000 -i a -t emmc
get Active Image info success:240000, 400000, 1, 1, 3
eMMC kernel command: root=/dev/mmcblk0p3
Load data from emmc
Load done.
shell> bootkernel -b 0x200000 "console=ttyS0,115200 ip=static rw"
--- bootkernel ...
... CEFDK -> U-Boot status STAT_USR_FIN
L2sw mode ---
Working Cmd: console=ttyS0,115200 ip=static rw root=/dev/mmcblk0p3
CMD(0x48000)='console=ttyS0,115200 ip=static rw root=/dev/mmcblk0p3 '
WARNING: Ancient bootloader, some functionality may be limited!
- I have a JTAG interface but I don't the necessary stuff to use it. I have search for an arduino JTAG adapter but I have no found any good way.
- Two USB port are there but they are inactive. I read that they are used for diagnostic and specific utilisation.
- The final way is a mysterious plug, his name is "MPEG/ARM CONSOLE". I found nothing about it. [EDIT] I know wich pin is RX, TX and GND, from left to right (when you watch the plug): GND, TX, RX, ?, ?, ?.
I can maybe burn linux distribution directly on the HDD. ¯\\_(ツ)_/¯
Mother board infos


2CoB9
(21 rep)
Apr 16, 2020, 07:35 PM
• Last activity: Jan 1, 2024, 07:53 PM
0
votes
1
answers
314
views
how can I make socat simulate unplugging a serial device
I have this test program ``` import sys for line in sys.stdin: print(line.strip()) print("DONE") ``` if I get it to print out lines from a real device (an FTDI) ``` python3 demo.py > ttyFake.interface ``` and they get printed but if I stop the socat process with SIGINT or SIGTERM I get something lik...
I have this test program
import sys
for line in sys.stdin:
print(line.strip())
print("DONE")
if I get it to print out lines from a real device (an FTDI)
python3 demo.py > ttyFake.interface
and they get printed
but if I stop the socat process with SIGINT or SIGTERM I get something like this:
$ python3 demo.py
for line in sys.stdin:
OSError: [Errno 5] Input/output error
I have also tried this with no luck:
$ echo -ne '\004' >> ttyFake.interface # send ^D
Is there any way to make socat simulate the unplugging behaviour? Do I just need a better way to send a ^D
?
Subquestion:
I don't really know if ^D
is what the process detects in stdin to determine that input has finished, or just what you send to your terminal emulator to end the input.
Alex028502
(643 rep)
Oct 27, 2023, 04:15 PM
• Last activity: Oct 30, 2023, 07:48 AM
0
votes
0
answers
86
views
Why is the serial communication with this device failing?
I have two serial to USB adapters connected to my computer, each one is connected to a microcontroller. What I want to do is send commands to each microcontroller through UART (I'm using minicom), but only one is succeeding. Both send data to the computer, but only one is capable of receiving it. Th...
I have two serial to USB adapters connected to my computer, each one is connected to a microcontroller.
What I want to do is send commands to each microcontroller through UART (I'm using minicom), but only one is succeeding. Both send data to the computer, but only one is capable of receiving it.
This is the result after sending a command to one device.
This is what happens with the other device.
It's not that the connection is wrong, because I switched to Windows and both of them worked. Also, I have to add that the adapter started to fail when I attempted to transmit information to both devices at the same time (as *ttyUSB0* and *ttyUSB1*). It was working fine before that attempt. After that, it doesn't matter if only one is connected, one always works and the other doesn't. It is recognized by the computer as *ttyUSB0* but it never receives the information.
As more evidence that it's the software that is wrong and not the hardware: the LED of the failing adapter never turns on when it's supposed to be receiving data.
Edit: information about the two adapters and the microcontrollers.
**Device CH341**
[11208.020500] usb 3-2.3: new full-speed USB device number 23 using xhci_hcd
[11208.222337] usb 3-2.3: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.64
[11208.222345] usb 3-2.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[11208.222348] usb 3-2.3: Product: USB Serial
[11208.232359] usb 3-2.3: ch341-uart converter now attached to ttyUSB0
**Device FT232** (the one that doesn't receive data)
[11208.400547] usb 3-2.1.4: new full-speed USB device number 24 using xhci_hcd
[11208.613046] usb 3-2.1.4: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 6.00
[11208.613056] usb 3-2.1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[11208.613060] usb 3-2.1.4: Product: FT232R USB UART
[11208.613062] usb 3-2.1.4: Manufacturer: FTDI
[11208.613065] usb 3-2.1.4: SerialNumber: A9EYI2C0
[11208.621661] usb 3-2.1.4: Detected FT232RL
[11208.623137] usb 3-2.1.4: FTDI USB Serial Device converter now attached to ttyUSB1
The microcontrollers are both Black Pill boards (STM32F401)


EmTor
(1 rep)
Aug 8, 2023, 02:42 AM
• Last activity: Aug 8, 2023, 07:53 PM
0
votes
1
answers
818
views
How to make use of an M2 PCIe card UART interface?
I have a motherboard (`AIMB-218`) with an M2 E key slot and according to the documentation of the said motherboard the M2 slot supports UART. I am trying to use a wireless module (Wi-Fi + Bluetooth), which has a UART interface for controlling the Bluetooth adapter. Its documentation says that the Wi...
I have a motherboard (
AIMB-218
) with an M2 E key slot and according to the documentation of the said motherboard the M2 slot supports UART.
I am trying to use a wireless module (Wi-Fi + Bluetooth), which has a UART interface for controlling the Bluetooth adapter. Its documentation says that the Wi-Fi interface works using the PCIe bus and the Bluetooth uses UART interface.
I have booted a Linux Ubuntu on this system, but the UART interface does not show up in the /dev folder (there are only few ttyS*
entries which correspond to serial ports present on the motherboard) nor the Bluetooth controller appears in the system in any other way - the bluetoothctl
does not list any HCI devices.
The wireless module's chip is 88W8997
and the manufacturer claims it is supported by the Linux kernel.
My question is: How to make use of the UART interface of the card connected to the M2 slot?
VL-80
(234 rep)
Feb 16, 2023, 05:11 PM
• Last activity: May 4, 2023, 02:40 AM
0
votes
1
answers
39
views
How do I tell a /dev/ttyUSBN device that it's a master?
Using the terminology of ptys, the slave end connects to the CLI program and the master end connects to the user / keyboard / terminal emulator. I have an FTDI USB UART connecting my laptop's USB port to an embedded computer's serial port. It appears on my laptop as /dev/ttyUSB0. My laptop is suppos...
Using the terminology of ptys, the slave end connects to the CLI program and the master end connects to the user / keyboard / terminal emulator.
I have an FTDI USB UART connecting my laptop's USB port to an embedded computer's serial port. It appears on my laptop as /dev/ttyUSB0. My laptop is supposed to be the master end, and the embedded computer is supposed to be the slave end. But when I look at how /dev/ttyUSB0 behaves, it clearly thinks I'm the slave end. For instance, when the embedded computer sends a character to the laptop, the laptop send the character back again.
Is there a switch somewhere that tells the kernel driver that the laptop is the master, and not the slave?
enigmaticPhysicist
(1542 rep)
Apr 29, 2023, 09:11 AM
• Last activity: Apr 29, 2023, 01:52 PM
0
votes
1
answers
171
views
How to integrate radio modules to Linux networking stack
I want to know whether it is possible to add a radio link (point-to-point) to the link layer of the networking stack on Linux so that programs can communicate using TCP/IP. Assuming the only way to talk to these devices is over UART, and the necessary radio pairing has been done, is there a simpler...
I want to know whether it is possible to add a radio link (point-to-point) to the link layer of the networking stack on Linux so that programs can communicate using TCP/IP.
Assuming the only way to talk to these devices is over UART, and the necessary radio pairing has been done, is there a simpler way to do this from user space? This is a high-level diagram of how communication happens without this.
Thank You

Dennis
(1 rep)
Nov 9, 2022, 11:56 AM
• Last activity: Nov 9, 2022, 02:25 PM
0
votes
0
answers
1382
views
Minicom: send string when newline is detected
I have 3 different USB-to-UART FTDI cables and use minicom to debug some device. My problem is only one of these cables can buffer characters until I send a newline. Eg when I type the string "help", the device on the other side will not output the help string until I press Enter. The two other cabl...
I have 3 different USB-to-UART FTDI cables and use minicom to debug some device.
My problem is only one of these cables can buffer characters until I send a newline. Eg when I type the string "help", the device on the other side will not output the help string until I press Enter. The two other cables don't seem to wait for a newline when sending, typing the same string "help", I am seeing no output and newline will just add new lines to whatever I have typed.
I have enabled the following settings each time I start the minicom session:
- echo on
- linefeed on
- carriage return on
The cables I am using are:
- TTL-232R-3V3 (this one works)
- TTL-232R-3V3
- TTL-234X-3V3
Initially, I thought this was an issue with the cable but because another TTL-232R-3V3 has not worked, I think this may be a minicom configuration. But I can't find any configuration that would control this behaviour for my minicom session.
user1397215
(101 rep)
May 23, 2022, 09:20 PM
0
votes
1
answers
224
views
Reading /dev/ttyS4 from a BeagleBone running Debian 10 not what is written
I am pulling my hears trying to make ttyS4 up and running on a Beaglebone black. I have set up UART4 in my /boot/uEnv.txt (see it at the bottom of my question). On the Beaglebone I have the comms cape and the RS-485 A/B are wired to the battery BMS device. The comms are 9600 bauds 8N1. To sniff the...
I am pulling my hears trying to make ttyS4 up and running on a Beaglebone black.
I have set up UART4 in my /boot/uEnv.txt (see it at the bottom of my question).
On the Beaglebone I have the comms cape and the RS-485 A/B are wired to the battery BMS device.
The comms are 9600 bauds 8N1.
To sniff the content I do:
(stty -F /dev/ttyS4 9600 cs8 -cstopb -parenb; cat -v /dev/ttyS4) | od -t x1
And what I notice in the logs is that it is no the expected stream of bytes: I should have something starting with A5 01 90 08 XXXX for 13 bytes.
What might have made the bytes different?
What should I do to troubleshoot this?
0000000 4d 2d 27 5e 41 21 5e 48 5e 42 58 5e 40 5e 40 5e
0000020 40 5e 40 5e 40 5e 40 4d 2d 51 5e 40 4d 2d 27 5e
0000040 41 21 5e 48 5e 42 58 5e 40 5e 40 5e 40 5e 40 5e
0000060 40 5e 40 4d 2d 51 5e 40 5e 40 4d 2d 27 5e 41 21
0000100 5e 48 5e 42 58 5e 40 5e 40 5e 40 5e 40 5e 40 5e
0000120 40 4d 2d 51 5e 40 4d 2d 27 5e 41 21 5e 48 5e 42
0000140 58 5e 40 5e 40 5e 40 5e 40 5e 40 5e 40 4d 2d 51
My uEnv.txt:
cat /boot/uEnv.txt
#Docs: http://elinux.org/Beagleboard:U-boot_partitioning_layout_2.0
uname_r=4.14.108-ti-r131
#uuid=
#dtb=
###U-Boot Overlays###
###Documentation: http://elinux.org/Beagleboard:BeagleBoneBlack_Debian#U-Boot_Overlays
###Master Enable
enable_uboot_overlays=1
###
###Overide capes with eeprom
#uboot_overlay_addr0=/lib/firmware/BB-UART1-00A0.dtbo
#uboot_overlay_addr1=/lib/firmware/BB-UART2-00A0.dtbo
#uboot_overlay_addr2=/lib/firmware/BB-UART4-00A0.dtbo
#uboot_overlay_addr3=/lib/firmware/BB-UART5-00A0.dtbo
###
###Custom Cape
#dtb_overlay=/lib/firmware/.dtbo
###
###Disable auto loading of virtual capes (emmc/video/wireless/adc)
#disable_uboot_overlay_emmc=1
disable_uboot_overlay_video=1
disable_uboot_overlay_audio=1
disable_uboot_overlay_wireless=1
disable_uboot_overlay_adc=1
###
###PRUSS OPTIONS
###pru_rproc (4.14.x-ti kernel)
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
###pru_rproc (4.19.x-ti kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-19-TI-00A0.dtbo
###pru_uio (4.14.x-ti, 4.19.x-ti & mainline/bone kernel)
#uboot_overlay_pru=/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
###
###Cape Universal Enable
enable_uboot_cape_universal=1
###
###Debug: disable uboot autoload of Cape
#disable_uboot_overlay_addr0=1
#disable_uboot_overlay_addr1=1
#disable_uboot_overlay_addr2=1
#disable_uboot_overlay_addr3=1
###
###U-Boot fdt tweaks... (60000 = 384KB)
#uboot_fdt_buffer=0x60000
###U-Boot Overlays###
cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet
#In the event of edid real failures, uncomment this next line:
#cmdline=coherent_pool=1M net.ifnames=0 lpj=1990656 rng_core.default_quality=100 quiet video=HDMI-A-1:1024x768@60e
##enable Generic eMMC Flasher:
##make sure, these tools are installed: dosfstools rsync
#cmdline=init=/opt/scripts/tools/eMMC/init-eMMC-flasher-v3.sh
Stéphane de Luca
(173 rep)
Feb 22, 2022, 11:20 AM
• Last activity: Feb 22, 2022, 03:30 PM
0
votes
1
answers
483
views
Trouble finding on-board serial port via UART: "-bash: echo: write error: Input/output error"
I have an old tv box that I wiped recently with Linux. I would like to connect a device to its onboard UART pins, to which I've soldered wires that connect to a UART adapter on my PC. I opened up a PuTTY serial monitor that reads incoming data while simultaneously trying to send data from the tv box...
I have an old tv box that I wiped recently with Linux. I would like to connect a device to its onboard UART pins, to which I've soldered wires that connect to a UART adapter on my PC. I opened up a PuTTY serial monitor that reads incoming data while simultaneously trying to send data from the tv box. But whenever I try to interact with any of the
ttyS*
ports, I just get -bash: echo: write error: Input/output error
. I've tried using echo
, screen
and minicom
, but all of them seem to spit out the same error. While messing around with setserial
, I get these kinds of error messages:
root@arm-64:~# setserial /dev/ttyS1 uart 16550
Cannot set serial info: Invalid argument
I'm totally unsure what to do, it seems almost as if it's none of these four ports, but I don't see another option for UART. I'm looking to at least verify the port name that my device is connected to so I can use it down the line.
TV Box model:
Tx mini 3 s905w processor
Jeebus
(1 rep)
Jan 9, 2022, 09:22 PM
• Last activity: Jan 10, 2022, 08:21 AM
-1
votes
1
answers
2536
views
Manually installing drivers on Linux Mint
I am currently trying to install a driver through terminal. It is for the USB UART XR21B1411 serial port adapter. I installed it in the past, but cannot remember how I did it. Here is a link to the driver: https://www.maxlinear.com/content/document.ashx?id=21651 As you can see, there is a Makefile,...
I am currently trying to install a driver through terminal. It is for the USB UART XR21B1411 serial port adapter. I installed it in the past, but cannot remember how I did it. Here is a link to the driver: https://www.maxlinear.com/content/document.ashx?id=21651
As you can see, there is a Makefile, two .h files and two .c files.
How might I install this driver? Any help would be greatly appreciated!
Ben G
(1 rep)
Nov 4, 2021, 07:39 PM
• Last activity: Nov 4, 2021, 08:01 PM
0
votes
1
answers
705
views
Enabling second UART in U-Boot
I am working on a project with SAMA5D3-xplained board with CortexA5 processor and embedded Linux. I would like to send and receive some data via UART during U-Boot is running and before a kernel is loaded to the RAM. I have no idea what I should do. Should I add the second UART to U-Boot device tree...
I am working on a project with SAMA5D3-xplained board with CortexA5 processor and embedded Linux. I would like to send and receive some data via UART during U-Boot is running and before a kernel is loaded to the RAM. I have no idea what I should do. Should I add the second UART to U-Boot device tree source file? Should I change something in a board configuration file? Do you have any ideas on what steps I should take to achieve my goal? Thank you in advance for any help.
**EDIT:**
I would like to use UART from U-Boot C code, not from U-Boot commands. I need to communicate with one of a peripheral device before the kernel is loaded to the RAM.
user6758
(23 rep)
Apr 8, 2021, 07:52 PM
• Last activity: Apr 9, 2021, 06:47 AM
Showing page 1 of 20 total questions