[SOLVED] apu2 internal TTL com port



  • the apu2 and older alix boards have a com2 port header which works on 3.3V TTL logic, i have a usb to ttl adapter and i tried plugging in tx and rx pins to the apu2 but i just see garbage on all baud rates, has any1 tried this or does it need to be enabled somewhere in the pfsense kernel to be able to use this.

    the below works flawless though
    usb to ttl adapter –-> ttl to serial ---> apu2 serial port



  • What data do you expect to see on the other serial port - console?

    It's years since I last ran something on an ALIX second serial port and it takes some time for the memories to come back. Original plan back then was to control displays from that port but that project was dismissed. Thank god!
    I'll post a reply if memory serves me something.



  • well we want to use the second serial port for serial console and use the main serial port for other things



  • any idea coz when i connect a usb to ttl adapter to that im seeing garbage, do we need to tell pfsense to redirect to that or something?

    i have tried 2 different chipset usb to TTL adapters and its same on both, pcengine guys told me its supposed to work



  • it seems the apu2 bios works on com1 only but i was told i could redirect pfsense console to internal com2, any idea what to change where inorder to get the pfsense console output to this internal com2 port?



  • @xbipin:

    do we need to tell pfsense to redirect to that or something?

    Jepp, it uses the first ser port if not told to change that.

    On an AUP2 look at /var/log/dmesg.boot and you'll find
    uart0: <16550 or compatible> at port 0x3f8-0x3ff irq 4 flags 0x10 on isa0
    uart0: console (115200,n,8,1)

    But I don't see a uart1 for the other port there … and cannot find where to change the port in pfSense's GUI at all. Sorry, I don't remember how we wanted to use that port back in 2012 or so. Getting old...
    But I still have a dozent or so Max232 level converters laying around for that purpose. Never used.


  • Banned

    This is not possible without recompiling the boot blocks and other weirdo messing, just waste of time IMNSHO.

    https://www.freebsd.org/doc/handbook/serialconsole-setup.html



  • well i see uart1 on my board

    uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
    uart0: console (115200,n,8,1)
    orm0: <isa option="" rom=""> at iomem 0xef000-0xeffff on isa0
    apuled0: <apu2> at iomem 0xfed81610-0xfed8161b,0xfed81664-0xfed81667 on isa0
    ppc0: cannot reserve I/O port range
    uart1: <16550 or compatible> at port 0x2f8 irq 3 on isa0</apu2></isa>
    

  • Banned

    That's not the problem. The problem is that COM1 is hardcoded in the boot blocks. Changing it on the fly is not possible. See the linked howto.


  • Rebel Alliance Developer Netgate

    You can install using the ADI image to get a serial console on COM2 but I'm not sure what other side effects you might have with that image on non-ADI hardware.



  • Thanks for the info, btw I found one method to get serial console on com2 so I'll get time to test it on Saturday and report back if it works, the other reason I want this to work is for a remote site where they only have a USB to ttl adapter which can connect to com2 and traffic shaping is crashing their system so need to get a crash dump because the system isn't saving it and keeps rebooting


  • Netgate Administrator

    I have found that nothing more is required than adding to /boot/loader.conf.local

    comconsole_port="0x2F8"
    

    You may not get the full boot output from that but you should get the console/menu.

    Steve



  • Exactly the same stuff I read in a Reddit post and wanted to try, don't want the boot output, just want the console menu and afterwards



  • @stephenw10:

    I have found that nothing more is required than adding to /boot/loader.conf.local

    comconsole_port="0x2F8"
    

    You may not get the full boot output from that but you should get the console/menu.

    Steve

    i tried this and it works but i have another issue which i was coordinating with pcengine guys and came to the conclusion that when we redirect serial console to com2 header on apu2 using the above in loader.conf.local then console stops and the com1 and it get silent so thats fine but then the com2 starts giving the console along with a constant stream of garbage which never stops, at first i was told my usb to uart adapter might be faulty so tried a different chipset one and its same and also tried on 2 apu2 boards and it same so any idea why is pfsense or freebsd doing this?


  • Netgate Administrator

    What is it actually sending to the port?

    Steve


  • Rebel Alliance Developer Netgate

    "garbage" makes me think it's sending at a different serial speed, whatever it is. Doesn't sound like anything that pfSense or FreeBSD would be doing though.



  • from time to time i see valid serial output but then it comes along with lot of garbage characters non stop, i tried the default baud rate of 115200 as well as all possible baud rates and its same except on other baud rates its total garbage, atleast on 115200 i see some of the pfsense output but the garbage is so much that it comes in bits and pieces.


  • Netgate Administrator

    A bad connection or interference on the cable can appear like that. Is the cable particularly long?

    Steve



  • no its hardly 15cm and plus its happening on my adapter and apu2 as well as a different one in a client location.


  • Netgate Administrator

    Do you see that even when the console has not been switched to it?

    Steve



  • yes but only when i press enter then all the garbage starts non stop, on a fresh boot when i connect doesnt display anything.


  • Netgate Administrator

    Hmm, sure sounds like something else is using the port. Just because the output is not ASCII does not mean it's garbage though, it may be some other format.

    Are you sure you haven't configured anything else on that port? Do you see that output even if pfSense it not booted?

    Try looking at the raw serial output rather than using a terminal emulator. That will rely on the port settings being correct.

    Steve



  • when pfsense is not booted its blank coz the apu2 sends its bios menu only to the com1 which is the serial port, i have nothing else configured just a basic pfsense firewall with mostly everything default.

    i dont understand what do u mean by "Try looking at the raw serial output rather than using a terminal emulator. That will rely on the port settings being correct."


  • Netgate Administrator

    Ok, and hitting enter at that point does not start a stream of unreadable characters?

    That implies it's something being loaded by pfSense rather than debug output from the CPU or whatever.

    Are you sure you don't have say lcdproc or nut loaded?

    You are looking at the serial output with a terminal emulator that tries to interpret the data as characters or instructions to move the cursor etc but not all serial data is that.

    Try running on the connected device, for example:

    cat /dev/(your usb serial port) > /tmp/serial_output
    

    Then open that file in a hex editor. Since you can;t set the port speed it replies on whatever the port settings are already set to which must be correct to see meaningful data.

    Moving this to hardware since it's not 2.4 related.

    Steve



  • no i dont have lcdproc or nut loaded, give me a few days as i have ordered a few more usb to uart adapters so once they arrive can attach those and test as well and report back as well as pcengines ppl are also testing it on their end to see if its debug info or no


  • Netgate Administrator

    I only suggested debug output there because the ALIX had this diagram available which is labelled debug so it seems to be something they might have done previously. A lot of speculation there!
    However if it were I might expect to see it whether or not pfSense loaded.

    Steve



  • pcengines ppl just tested it using the same usb to ttl adapter and they send me a screenshot of it working and displaying properly so now im wondering if my tera term app is faulty or no so trying with putty



  • i tried with putty and its still same so lets just wait for the other adapter to come then ill report back



  • You wrote, "apu and older alix boards", which of them do you have here in that case!?
    Differences between Alix and APU

    115200,n,8,1
    Must be set up at three locations;

    • Putty or TerraTerm console program
    • Board BIOS for the COM port
    • pfSense directly

    then it will be often looking like the other one (com or serial port)
    Also on the other side it can surely be that the chip from the USB to Serial Adapter will not be supported due to
    whatever a circumstance. Be sure that you will be not led into a trap searching something you could not fix!

    If you are using an APU2Cx board you may be happy with that equipment here, it is working out of the box!
    As said both are working together with pfSense and verion 2.3.x & version 2.4 for me.
    APU2C4 serial to USB combo
    USB to RS232 cable

    And please make sure that you are using a null modem cable and not another serial cable!
    PC Engines HowTow collection

    If nothing helps you out here, but you will have the need for another console port you may have a look over that piece
    of hardware. AirConsole



  • AirConsole is nice, use it for years already. But it's basically a serial to USB converter with Ethernet extender. Doesn't change a thing on displaying the data, only extends the path.



  • ok finally got it working, the reason for garbage was along with the tx and rx line gnd also needs to be connected and my gnd pin on the adapter had a loose solder joint so gnd pin wasnt making contact, on the new adapter connected it and serial console started showing on com2 without issues, thanks for all the help


  • Netgate Administrator

    Ah, yup that'll do it!  :D

    Steve



  • Meanwhile I found why my APU1 doesn't show uart1.
    That's an old beta board with an even older firmware. I bet if I'd update it…  ::)

    Good to hear that you got your problem solved! Productivity of this forum is quite amazing.



  • The nice thing about the APU series is that the GPIO driver written for the APU1 works with the newer APU2 and APU3. They used the same exact Nuvoton chip so I really appreciate the small things like that. Their Alix case with 3 LAN works with the newer APU as well.

    I just built a Zoneminder server based on the APU3 with 4Gig RAM and I got the PCIe slot option for a 2 port POE card, the Startech ST2000PEXPSE
    The slot is horizontal like the Soekris was.
    Zoneminder is hammering it -but it is not running that hot. It was just an experiment to see if the APU has other usage cases besides router.
    I have 3 now stacked.
    I really like coreboot too.. Really feels like an industrial setup.


  • Banned

    @jahonix:

    Meanwhile I found why my APU1 doesn't show uart1.
    That's an old beta board with an even older firmware. I bet if I'd update it…  ::)

    You can now update the BIOS from pfSense.

    
    pkg install flashrom
    rehash
    flashrom -w apu??????.rom -p internal
    
    


  • Thanks Dok
    I found you must pass the programmer thru:

    flashrom --programmer internal -w /apu/apu2_v4.6.0.rom
    


  • Thanks Dok and FranciscoFranco, worked perfectly.



  • @doktornotor

    Any ideas why I'm getting a board mismatch error:

    Calibrating delay loop… delay loop is unreliable, trying to continue OK.
    coreboot table found at 0xdffae000.
    Found chipset "AMD FCH".
    Enabling flash write... OK.
    Found Winbond flash chip "W25Q64.V" (8192 kB, SPI) mapped at physical address 0x00000000ff800000.
    This coreboot image (PC Engines:PC Engines apu2) does not appear to
    be correct for the detected mainboard (PC Engines:PCEngines apu2).
    Aborting. You can override this with -p internal:boardmismatch=force.

    As you can see in the logs, they're the same exact board so I'm not sure why there's a mismatch?

    EDIT: Nevermind, I already figured it out. It seems to be caused by the space between PC and Engines so forcing it fixed the problem.