# Real serial port



## balanga (Mar 6, 2018)

How do I access a real (RS232) serial port on FreeBSD?


----------



## aragats (Mar 7, 2018)

Aren't they /dev/ttyuX?
I have a couple of MITSPC Intel Atom D2500 systems with real serial ports:
	
	



```
ls /dev/ttyu*
/dev/ttyu0      /dev/ttyu0.lock /dev/ttyu1.init /dev/ttyu2      /dev/ttyu2.lock /dev/ttyu3.init
/dev/ttyu0.init /dev/ttyu1      /dev/ttyu1.lock /dev/ttyu2.init /dev/ttyu3      /dev/ttyu3.lock
```


----------



## Snurg (Mar 7, 2018)

https://www.freebsd.org/doc/en/books/faq/serial.html


----------



## balanga (Mar 7, 2018)

aragats said:


> Aren't they /dev/ttyuX?
> I have a couple of MITSPC Intel Atom D2500 systems with real serial ports:
> 
> 
> ...


`ls -al dev/tty*`

```
crw-------   1 root  tty       0x3a Nov  9 16:27 ttyv0
crw-------   1 root  wheel     0x3b Nov  9 16:25 ttyv1
crw-------   1 root  wheel     0x3c Nov  9 16:25 ttyv2
crw-------   1 root  wheel     0x3d Nov  9 16:25 ttyv3
crw-------   1 root  wheel     0x3e Nov  9 16:25 ttyv4
crw-------   1 root  wheel     0x3f Nov  9 16:25 ttyv5
crw-------   1 root  wheel     0x40 Nov  9 16:25 ttyv6
crw-------   1 root  wheel     0x41 Nov  9 16:25 ttyv7
crw-------   1 root  wheel     0x42 Nov  9 16:24 ttyv8
crw-------   1 root  wheel     0x43 Nov  9 16:24 ttyv9
crw-------   1 root  wheel     0x44 Nov  9 16:24 ttyva
crw-------   1 root  wheel     0x45 Nov  9 16:24 ttyvb
```


----------



## balanga (Mar 7, 2018)

Snurg said:


> https://www.freebsd.org/doc/en/books/faq/serial.html



I've looked through that but it does not really help. I can't see anything in dmesg which shows that the serial port has been recognised.


----------



## balanga (Mar 7, 2018)

I'm running FreeBSD on a ThinkPad 600 ( a 20 year old machine) and came across this posting... which suggests that the serial port may be disabled in BIOS and I made need a *DOS program "ps2" * - now where would I find that? Don't suppose there is a FreeBSD equivalent...


----------



## balanga (Mar 7, 2018)

I managed to enable the serial port in the BIOS and now have ctty. cuaU0 and CuaU2.


----------



## balanga (Mar 8, 2018)

balanga said:


> I managed to enable the serial port in the BIOS and now have ctty. cuaU0 and CuaU2.



Still not getting anywhere with being able to use Heyu 

How can I get the name of the serial port I'm using? There is only one.


----------



## Snurg (Mar 8, 2018)

It's quite a while ago I did serial comms with FreeBSD.
It's really painful because the documentation is so scattered and not really helpful if it's not about terminals.

A hint is that the cuaU is in uppercase, this shows its parameters are not yet initialized. You have to do that with stty:
https://www.freebsd.org/doc/handbook/serialcomms.html
Best is to read the stty man page a few times


----------



## ralphbsz (Mar 8, 2018)

Sorry, but cuaU (with uppercase U) is a USB-based serial port.  I think it uses the ucom driver.

Traditional motherboard serial ports that are based on the 8250 and 16550 chips (which today are usually integrated into IO bridge chips) use the uart driver, and create cuau (lowercase U) devices.

You asked "how can I get the name of the serial port".  If there is only one, the name should be obvious.  And if there is only one, it should be cuau0 and ttyu0.


----------



## Snurg (Mar 8, 2018)

Thanks ralphbsz!
You are right, I remember now that it was an USB-RS232 adapter on the laptop and not the real 9-pin adapter on the PC.
How vintage RS-232 has become now that memories begin to fade...


----------



## balanga (Mar 8, 2018)

ralphbsz said:


> Sorry, but cuaU (with uppercase U) is a USB-based serial port.  I think it uses the ucom driver.
> 
> Traditional motherboard serial ports that are based on the 8250 and 16550 chips (which today are usually integrated into IO bridge chips) use the uart driver, and create cuau (lowercase U) devices.
> 
> You asked "how can I get the name of the serial port".  If there is only one, the name should be obvious.  And if there is only one, it should be cuau0 and ttyu0.



It turns out I should have been using ttyu0 as you suggest. That only appeared after I enabled the serial port it the BIOS. I did notice that there was also a ttyu2 although there is only a single port.

The cuaU0 fooled me because I didn't realise the TP 600 had a USB port...


----------

