RE: what decides allowable serial speeds?
RE: what decides allowable serial speeds?
- Subject: RE: what decides allowable serial speeds?
- From: "Joe van Tunen" <email@hidden>
- Date: Thu, 27 Jul 2006 13:45:50 -0700
- Thread-topic: what decides allowable serial speeds?
Are there any USB serial adapters that go higher than 230.4 kbps?
Power Mac G3's and G4's have built in serial ports (non-beige Macs require something like a Griffin gPort to make the port accessable to external devices). Normally they can go only as high as 230.4 kbps but they can be externally clocked. An external clock of almost 15 MHz is required for asynchronous data at 921.6 kpbs (16x clock mode * 921k 15M). I don't know if you can put 15 MHz on the serial port pin (I think MIDI devices use an external 2 MHz clock).
Another option is to use the 1x clock mode. Using a baud rate generater value of 0 and the internal clock of 3.6864 MHz will give 921.5 kbps. The 1x clock mode is not good for asynchronous data though. It's usually used when both devices are connected to the same clock (externally clocked) such as MIDI devices. If your device can be externally clocked then the 1x clock mode with an external clock can be used.
The SCC chip has another clock PCLK that can be used by the baud rate generator but it's frequency differs on various Macs and is not at least 16 times faster than the 3.6864 MHz clock (I think on a B&W G3 the PCLK is approximately 22 MHz, G4 -> 15.7 MHz, etc).
The source code of drivers for the built-in serial ports are available from Darwin and can be modified to support the other clock modes. They already support external clocking for MIDI.
> ----------
> From: Garth Cummings
> Sent: Wednesday, July 26, 2006 8:12 AM
> To: Sean McBride
> Cc: Darwin development list
>
> Sean,
>
> On Jul 25, 2006, at 7:01 PM, Godfrey van der Linden wrote:
>
>
> Actually you don't have to, there is an ioctl that will allow you to ask the driver for any random speed.
>
> It should be available on any 10.4.x system.
>
> #include <IOKit/serial/ioss.h>
>
> The ioctl is IOSSIOSPEED. It takes a single speed_t argument.
>
> Godfrey
>
>
> Also, the current version of SerialPortSample <http://developer.apple.com/samplecode/SerialPortSample> shows how to use this ioctl.
>
> --gc
>
>
>
> On 26/07/2006, at 4:06 AM, Sean McBride wrote:
>
>
> Hi all,
>
> I notice that the highest speed termios.h defines is B230400. I have a
> serial device that supports higher speeds such as 921600. Is it not
> present in termios.h because it is unsupported? tcsetattr() returns
> success after setting the speed to 921600. Do the supported speeds
> depend exclusively on the serial hardware (USB-serial adapter these
> days)? Or does the OS have influence on which speeds are allowed?
>
> I ask all this because my device works at many speeds, except the
> highest speed it supposedly supports. I'm trying to figure out if this
> is the device's fault, the OS's, or the USB-Serial Adapter's.
>
> Thanks,
>
> PS: I hope this list is appropriate, sorry if not.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng email@hidden
> Rogue Research www.rogue-research.com
> Mac Software Developer Montréal, Québec, Canada
>
>
>
> ____________________________________________________________________
> Garth Cummings email@hidden
> Sr. Software Engineer
> Apple Developer Technical Support
>
> <http://developer.apple.com/technicalsupport>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden