On Wed, Oct 29, 2025 at 1:04 AM Arina Lynn Grace
<[email protected]> wrote:
>
> Good evening,
>
> I'm trying to get serial data from a microcontroller board (Adafruit Feather 
> RP2350) for debug purposes. My test code sends out an incrementing number 
> every x seconds. If x == 1 second, it works no problem with any serial 
> monitor (such as tio, minicom, or the Arduno IDE). However, if x >= 2.3 
> seconds, the data stops after a message or two. The serial port doesn't 
> disconnect when the issue occurs, I only get disconnect alerts when I reset 
> or physically unplug the board. I have tried multiple microcontroller boards 
> from multiple brands, I've switched cables, USB ports, nothing works. This 
> issue occurs on my Debian 12 Framework 13 laptop and my partner's Debian 13 
> Thinkpad T480s, but not my Debian 10 server, my freshly reflashed Raspberry 
> Pi 3, or my WIndows 10 PC. Those computers accept the data just fine. I know 
> the code is running properly on the boards because I set the built in LED to 
> flash every time a serial message is sent out. The common factor seems to be 
> our laptops.
>
> I have checked lsof /dev/ttyACM0 to rule out other software grabbing the 
> serial port, I've checked udev and stty rules (well, my partner did) to the 
> best of my (well, her) ability, everything is identical between the different 
> computers serial settings. My partner updated her kernel to the latest 
> version and it still occurs.
>
> I'm out of ideas, and this issue has completely stopped my personal projects. 
> Does anyone have any ideas what could be going wrong?

Some code or a minimal reproducer would probably be helpful.

One thing I do after opening /dev/ttyACM0 is set TIOCEXCL on the file
descriptor to ensure other programs, like NetworkManager or
ModemManager, do not open the device:

    const char device[] = "/dev/ttyACM0";
    fd = open(device, O_RDWR | O_NOCTTY | O_SYNC);
    if (fd == -1) {
        log_error("Failed to open device %s: %s\n", device, strerror(errno));
        goto finished;
    }

    if (ioctl(fd, TIOCEXCL, NULL) == -1) {
        log_warn("Failed to set TIOCEXCL on device: %s\n", strerror(errno));
    }

Jeff

Reply via email to