Using Serial Port on PFSense
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
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!
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.
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)
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
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).
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.
It's still not shown in dmesg,
Neither ttyu0 not cuau0 appears in my dmesg output but uart0 does.