CoolTerm with custom baud rates on Raspberry Pi 5

If you have specific questions or problems with any of my Open Source Projects, post them here.
Post Reply
robertrau
Posts: 3
Joined: Wed Jun 25, 2025 6:22 pm

CoolTerm with custom baud rates on Raspberry Pi 5

Post by robertrau »

Thank you for CoolTerm. I have used it for years on my Mac and then on the other platforms. I am finishing a Arduino compatible board for kids and model rocketry. My board has a FTDI230XQ that works nicely up to 3Mbaud. I choose 1Mbaud for my console speed and this works fine on my Mac. I am unable to get it to work on my Raspberry Pi 5. I put a scope on the TxD line and even though I set a custom baud rate of 1Mbaud, the speed I measure is 9600 baud. I tested my pi with
stty -F /dev/ttyUSB0 1000000
echo UUUUU >/dev/ttyUSB0
and I measure 1Mbaud.
I tested with screen too and that also gave me 1Mbaud.
So I think the hardware and OS are able to support 1Mbaud. I know XOJO has some issues with non-standard baud rates on Linux but I know some users use a shell command to set the baud rate. I don't know what method you are using but I am having trouble making 1Mbaud work.

Any ideas?

Thank you for your time.

Bob Rau
User avatar
roger
Site Admin
Posts: 542
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm with custom baud rates on Raspberry Pi 5

Post by roger »

Hi Bob,

I'm using the standard (i.e. built-in) method to set a custom baudrate on all platforms: SerialConnection.baud = 1000000

I'll look into it. I wasn't aware that there may be an issue with this on Linux systems. I'm only using CoolTerm on the Raspberry Pi sparingly, and nobody else has reported any issues with custom baud rates.

Do you know if this is an issue with Linux in general, or only on the Raspberry Pi? I don't have a Pi 5, but I do have a Pi 4, and I have some FTDI-based adapters. I'll test this on my end.

Do you happen to know which shell command other might be using? Is it stty?

Roger

PS: Thanks for creating the Serial Port Test example project in REALBasic so many years ago! It's one of the example projects that got me (as well as CoolTerm) started with REALBasic.
robertrau
Posts: 3
Joined: Wed Jun 25, 2025 6:22 pm

Re: CoolTerm with custom baud rates on Raspberry Pi 5

Post by robertrau »

I have some answers, I'll get the rest this weekend.
From searching the web some are using 'setserial' but that is not on the Raspberry Pi by default. sudo apt install works. setserial is a little hard to love, you first must run it to get the clock to the baud rate divider, then divide that by your baud rate, then replace the 38400 baud rate 'slot' with your new divisor. This weekend I will find out if that works.
I will try this on my little Ubuntu x86 machine this weekend too.
robertrau
Posts: 3
Joined: Wed Jun 25, 2025 6:22 pm

Re: CoolTerm with custom baud rates on Raspberry Pi 5

Post by robertrau »

I have gone a bit crazy the last few days playing with a little XOJO program for testing serial. See my post on the XOJO forums. I hope it is useful to you.
https://forum.xojo.com/t/raspberry-pi-5 ... pter/85736

Bob
User avatar
roger
Site Admin
Posts: 542
Joined: Fri Apr 24, 2009 12:41 am
Contact:

Re: CoolTerm with custom baud rates on Raspberry Pi 5

Post by roger »

Thanks, Rob. Interesting thread.

I have been successfully experimenting with stty. And I found a way to make the current build work with custom baud rates.
- Set CoolTerm to the custom baud rate, e.g. 1000000
- Open the serial port. The baud rate won't be correct.
- Close the serial port.
- Use stty -F /dev/ttyUSB0 1000000 in a command terminal
- Re-open the serial port in CoolTerm. It is now set to the custom baud rate.

As you point out in your Xojo forum post, Xojo overwrites the baud rate when the port is opened. However, if you set SerialConnection.Baudrate to a non-standard baudrate like 1000000 it will NOT overwrite the currently set baud rate. So, if you set the baud rate in CoolTerm to 10000000, then use stty to set the custom baud rate to 1000000, CoolTerm's attempt to set it to 1000000 will be ignored.

I think I can use this to my advantage and issue an stty command when the code sets the port options.
Post Reply