Serial port stops working after some time

Discussions related to using VirtualBox on Windows hosts.
Post Reply
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Serial port stops working after some time

Post by amhblore »

Hi,
I have a Windows 10 host with QNX 4.25 as the guest OS. The com ports on the guest OS are mapped to the host com ports. com1<->com1 com2<-->com2 etc. The application in the QNX guest OS continuosly transmits data on com1. After sometime transmission stops. Any pointers would be helpful. I have seen a couple of other similar posts but no solution. Let me know if any data is needed to collect serial VB logs.

viewtopic.php?t=110909

viewtopic.php?t=113539
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

I did some more tests. The same VM works under VMWare Workstation Pro without any issues. Upgraded VBox to 7.1.10 which was released on June 3rd. Still the same issue.
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

The issue is reproducible with a Ubuntu guest as well. Further investigation has found that the device driver on the guest OS is waiting for data on the serial line, when actually there is none. Some how the VBox is signalling the guest OS that data is available when its not.
By simulating a data return(just by pressing an enter key or any character), the data transmission conitnues.
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

Is there anyway to bump up the log level to log all serial info?
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

In the logs I see the following error during VM bootup. Is it a cause for concern? If it cant change, I assume it will remain the same, but not cause any issues further down.

DEV_SERIAL level 1 Serial#0: Failed to change parameters to 9600,NONE,5,1 -> VERR_INVALID_PARAMETER
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

I see a ticket open for the exact problem I am facing. Can somebody help me and let me know if this bug is fixed?

https://www.virtualbox.org/ticket/18668
Felix_g
Posts: 6
Joined: 16. Feb 2016, 11:16

Re: Serial port stops working after some time

Post by Felix_g »

These are different problems:

1) I think the error "Failed to change parameters to 9600,NONE,5,1" is caused by the real device, possibly because it doesn't support 5 data bits (for example, I use a USB-RS232 converter that only supports 7 and 8 bits).


2) Regarding the problem "guest OS is waiting for data on the serial line, when actually there is none", more information would be needed to investigate: Serial port configuration, whether the guest program uses "buffers" or reads data byte by byte...

I don't know if it's possible to activate a log in the "test builds" (https://www.virtualbox.org/wiki/Testbuilds) that would give us more details.


3) Regarding ticket 18668 (https://www.virtualbox.org/ticket/18668), the problem I detected was that, << in the case of unbuffered transmissions and operating systems that use edge interrupts >>, in VirtualBox 5.2 the "Data Available" interrupt was reset when a read occurred, and then set again if there was still data pending to be read. In subsequent versions of VirtualBox, the interrupt remains at 1, preventing the edge.

Since I cannot compile the software (or modify it since it is signed), I need someone to create a test version with, for example, the following change:

In "UartCore.cpp" file:
static void uartR3ByteFetch(PPDMDEVINS pDevIns, PUARTCORE pThis, PUARTCORECC pThisCC)
{
if ((pThis->uRegLsr & UART_REG_LSR_DR) && (pThis->uRegIer & UART_REG_IER_ERBFI)) /* New */
{
/* Reset the DR bit to allow a new interrupt edge. */
UART_REG_CLR(pThis->uRegLsr, UART_REG_LSR_DR);
uartIrqUpdate(pDevIns, pThis, pThisCC);
}


if (ASMAtomicReadU32(&pThis->cbAvailRdr))
...

If necessary with "buffered transmissions", the same would have to be done in the "uartR3RecvFifoFill" routine.

Another option would be to use pThisCC->pfnUartIrqReq(pDevIns, pThis, pThis->iLUN, 3) within the "uartIrqUpdate" routine to call VBOXVMM_PDM_IRQ_HILO (Note: 3 = PDM_IRQ_LEVEL_FLIP_FLOP "flip-flop - deassert and then assert the IRQ again immediately (PIC)", automatically deasserts it after delivery to the APIC (IOAPIC). @note Only suitable for edge trigger interrupts."), but I don't see a simple way to program it.
amhblore
Posts: 33
Joined: 12. Jun 2022, 07:44

Re: Serial port stops working after some time

Post by amhblore »

Regarding the question if the guest program uses buffers to read data, yes it uses buffers to read data.
Felix_g
Posts: 6
Joined: 16. Feb 2016, 11:16

Re: Serial port stops working after some time

Post by Felix_g »

Sorry, my research has only been on "without buffers" operation... Point 3 only affects very old operating systems (DOS, OS2...).

Try VirtualBox versions 5.2.28 and 7.0.10 to see if it is a problem due to internal code changes or incompatibility.
https://www.virtualbox.org/wiki/Download_Old_Builds
Post Reply