Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Using Serial Port on PFSense

    Scheduled Pinned Locked Moved Hardware
    6 Posts 4 Posters 11.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      sheepdawg
      last edited by

      Hi,

      Well, I'm beginning to explore a problem that I've been thinking about for a while. I'd like to use the serial port on my pfsense router to communicate with external hardware, in hopes of eventually communicating with an arduino microcontroller and indirectly controlling power relays. This would enable the router to power-cycle my DSL modems when a link is dropped, saving me much hassle and 'do you know the internet is down' phone calls.

      My first task is to understand how to send/receive data over the serial port. I've gotten so far as to identify my serial port:

      sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
      sio0: type 16550A
      sio0: [FILTER]

      This seems to imply that I should have a device named acpi0 that I can talk to, but that device does not exist.

      In /etc/remote, there is a line: sio0|com1:dv=/dev/cuad0:br#9600:pa=none:

      I do have /dev/cuad0, will this be the device I talk to when attempting serial communications?

      I found elsewhere on these forums the suggestion to use the tip command, but I'm not sure what this will allow.

      Can anyone point me in good directions to keep searching/reading?

      Thanks very much in advance for any assistance!

      Dave

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        tip would be for interactive use. If you just need to send some text across serial and don't care about the reply, just "echo foo > /dev/cuad0" and it'll go.

        If you need to read the reply and act on that as well, you'll have to look into serial programming in something like php, perl, python, etc.

        Remember: Upvote with the šŸ‘ button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • L
          lp
          last edited by

          Sorry to bother… Could you please tell me which "version" of pfSense you're using? (1.x or 2.x, compact flash or full version?)
          I'm running 2.x, "full version", and dmesg | grep "^sio" shows not result... No clue why my serial ports don't get detected (and I don't have /dev/cuaud0)

          1 Reply Last reply Reply Quote 0
          • W
            wallabybob
            last edited by

            @lp:

            I'm running 2.x, "full version", and dmesg | grep "^sio" shows not result…

            In pfSense 2.0 the serial ports are reported as uart devices during startup, for example:

            atrtc0: <at realtime="" clock="">port 0x70-0x73 irq 8 on acpi0
            uart0: <16550 or compatible> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
            atpic: Mismatched config for IRQ4: trigger edge, polarity low
            uart0: [FILTER]</at>

            @lp:

            No clue why my serial ports don't get detected (and I don't have /dev/cuaud0)

            On some systems serial ports can be disabled in the BIOS.

            On my system I have one serial which can be accessed as /dev/ttyu0 or /dev/cuau0 (but not /dev/cuaud0).

            1 Reply Last reply Reply Quote 0
            • L
              lp
              last edited by

              Yes they can be disabled in BIOS, but were not. I have cuau0 which later appeared as functional (echo something to it will appear at the other end of the cable), after disabling console usage for it.
              It's still not shown in dmesg, but working ok, so no problem. Just I can't get a console on it, but that's work in progress.

              1 Reply Last reply Reply Quote 0
              • W
                wallabybob
                last edited by

                @lp:

                It's still not shown in dmesg,

                Neither ttyu0 not cuau0 appears in my dmesg output but uart0 does.

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post
                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.