custom baudrate in native C application
Posted: Wed May 31, 2023 1:21 am
Hi Roger,
I am writing a native C application that runs on linux on a Raspberry Pi 4 (arm64 and armv7), but it should also run on my MacBook Pro (intel). The application is using a serial port: FTDI chip -> RS485 chip which is communicating to a bunch of microcontrollers over a bus.
The problem is that the source code that to open the serial port works on linux, but NOT on OSX.
The binary built for raspberry armv7 and arm64 work and when I on my Macbook (intel) boot into Ubuntu, the code also opens the serial port properly.
When I compile and run the source code on OSX, it seems like the application cannot receive the bytes properly:
I can see that the microcontroller receives bytes properly, and also sends data back properly, but in OSX nothing is received (the TX led of the FTDI adapter also does not blink, RX does however).
So, it's kind of a long stretch but since termios.h documentation for OSX is pretty sparse I am quite desperate, and since CoolTerm is working so smoothly on all platforms, I'd like to ask you:
How did you manage to support custom baudrates in CoolTerm on OSX ? or more specifically: how can I open up a serial port on OSX with a 921600 baudrate in native C?
I am writing a native C application that runs on linux on a Raspberry Pi 4 (arm64 and armv7), but it should also run on my MacBook Pro (intel). The application is using a serial port: FTDI chip -> RS485 chip which is communicating to a bunch of microcontrollers over a bus.
The problem is that the source code that to open the serial port works on linux, but NOT on OSX.
The binary built for raspberry armv7 and arm64 work and when I on my Macbook (intel) boot into Ubuntu, the code also opens the serial port properly.
When I compile and run the source code on OSX, it seems like the application cannot receive the bytes properly:
I can see that the microcontroller receives bytes properly, and also sends data back properly, but in OSX nothing is received (the TX led of the FTDI adapter also does not blink, RX does however).
So, it's kind of a long stretch but since termios.h documentation for OSX is pretty sparse I am quite desperate, and since CoolTerm is working so smoothly on all platforms, I'd like to ask you:
How did you manage to support custom baudrates in CoolTerm on OSX ? or more specifically: how can I open up a serial port on OSX with a 921600 baudrate in native C?