Putty serial port access to RS-232 console showing double character display with USB/Serial cable

5,106

I have no experience with such hardware at all, but I have found this thread describing similar symptoms on APU1D.

Response:

You have enabled both iPXE's own serial console support (CONSOLE_SERIAL in config/console.h) and also your BIOS's serial console redirection.

Wrong fix:

I did not realize that the PCBIOS console was enabled, because the option was commented out in config/console.h.

Undefining CONSOLE_PCBIOS in config/console.h solved my problem.

Explanation why it is wrong:

CONSOLE_PCBIOS is the "normal" console which writes to the screen and reads from the keyboard.

CONSOLE_SERIAL is iPXE's own serial port driver.

BIOS serial redirection is a feature implemented by your BIOS (and configurable via your BIOS setup screen) in which characters written to the screen will also be sent to the serial port.

The problem is that you have both CONSOLE_SERIAL and BIOS serial redirection enabled. iPXE writes each character both to the screen (due to CONSOLE_PCBIOS) and to the serial port (due to CONSOLE_SERIAL). Your BIOS then writes an additional copy of the character to the serial port, since you have BIOS serial redirection enabled. You therefore end up with two copies of each character on the serial port: one written directly by iPXE, one written by your BIOS.

The solution is to either disable CONSOLE_SERIAL or to disable your BIOS serial redirection (via your BIOS setup screen). Do not disable CONSOLE_BIOS

(probably meant CONSOLE_PCBIOS)

… unless you really don't want to be able to interact via a local keyboard and monitor.

You may find that iPXE's CONSOLE_SERIAL is more robust than your BIOS's serial redirection feature, and so it might be preferable to leave CONSOLE_SERIAL enabled and disable the BIOS serial redirection (via your BIOS setup screen).

Feedback from the asker:

At least in the case of this alix board the serial driver of iPXE is indeed the preferable variant (haven't tried other serial devices yet), as the menu isn't displayed properly using the BIOS's redirection feature.

Unfortunately these devices are shipped with a very limited BIOS, in fact only the boot settings can be altered.

Nevertheless, I found a solution I'm happy with. I modified the file config/defaults/pcbios.h by changing the line defining the CONSOLE_PCBIOS option to:

  #define CONSOLE_PCBIOS ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_TUI )

This way at least the menu is printed only once in my serial setup and the iPXE output seems also to be fine in normal cases (non serial).

Even if your case is somewhat different, I think the root cause is similar: two pieces of software send characters to the serial port, one of them is the BIOS. Find a way to silence one or the other.

Share:
5,106

Related videos on Youtube

Glassfrog
Author by

Glassfrog

Updated on September 18, 2022

Comments

  • Glassfrog
    Glassfrog almost 2 years

    I am trying to access a Matrix Sense firewall administration console through its RS-232 interface and the display I get with Putty is weird. The hardware is a PC Engines APU4B4 motherboard.

    I am using a cheap USB to RS-232 converter on my Windows 7 Machine. The device was recognized on COM4 port without any driver install needed on my side.

    So, with these parameters:

    • Speed 115200 bauds
    • 8 Data bits
    • 1 Stop Bit
    • Parity none
    • Flow control XON/XOFF

    Putty parameters page 1

    I also tweaked a little some other parameters to find a better display:

    • Local echo Force Off
    • Local line editing Force on

    But it does not seem to do much.

    Putty parameters page 2

    Eventually I get this weird display:

    Putty display

    Some characters are displayed twice and others just seem random. It looks like I'm close to a solution, but I can't figure out what's wrong here.

  • Glassfrog
    Glassfrog almost 6 years
    Thank you for that information. I think you found one cause of the problem, and what I understand is that the firewall I bought has a bug in it, because before your post, I did not know about iPXE. Now the second question is not solved and is related to the "rubbish" characters I can read after each line. So I think for the iPXE issue I should send the information to the manufacturer.
  • Kamil Maciorowski
    Kamil Maciorowski almost 6 years
    @Glassfrog I don't know if iPXE is involved or something else. I just suspect you have something else than your BIOS sending characters to the serial port and the screen. BIOS monitors what goes to the screen and echoes to the serial port, hence duplicated characters.
  • user1686
    user1686 almost 6 years
    It's not unlikely – I recently had the same problem with GRUB2; I enabled its own serial support and didn't realize the HP BIOS already did serial redirection, so I got two overlapping menus.