Re: Communication over usb serial cable
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com I am not sure that this is the proper list to put my query. I have connected my windows system to Mac using usb serial cable. First case where I am using ZTerm utility on Mac to communicate with Hyper terminal on windows. I configured and it is working properly. Second case, I have my application instead of ZTerm utility and I configured. Now when I send any data from hyper terminal, I get it in my application on Mac but not in proper format. Like if I press C in Hyper terminal, it shows #? (2 bytes) in Mac. Please suggest what I am missing here so that at least I am able to get proper data like ZTerm. Configuration details: baud - 115200 stop bit - 1 parity - NO data bits - 8 enable CLOCAL and CREAD. One more thing if I check my application with any modem attached on Mac only then I get the proper response of command like ATI etc. C 0x43 01000011 # 0x23 00100011 <http://www.easysw.com/~mike/serial/ or <http://digilander.libero.it/robang/rubrica/serial.htm> -- Terry _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... On Dec 5, 2008, at 12:01 AM, Rakesh Singhal wrote: mac ----- usb port <-----> usb serial cable <-----> serial port ---- windows CLOCAL and CREAD are irrelevant; CLOCAL simply means you do ignore modem status lines, and CREAD simply means you will allow receives. Different or multiple characters received with a single character transmitted is typically an indication that the receive baud rate is higher than the transmit baud rate, and therefore there is sampling occurring. Very old systems with tightly controlled UART parts used for their implementation used to used this technique to recognize the baud rate of inbound modem connections by comparing the sample bit pattern vs. the known sample patterns for the CR character at various known baud rates well below the sample baud rate; hit return a couple of times, and "presto! login: " at the right baud rate. It can also typically happen if the bit framing is off - e.g. when you tell it to use other than 8 bits of data, either by mistakenly specifying something other than 7 bits with some type of parity, or specifying something other than 8 bits with no parity, or you've set the wrong number of stop bits, etc.. With a little hand-waving, if your example of 'C' is an actual example, and we assume that the '?' was representing an unprintable character from line garbage or you hiting areturn character after the 'C', and the '#' was representing a printable '#' then: strongly implies that the bits are being time-compressed, implicating that the transmit baud rate is higher than the receive baud rate. I'd suggest either looking at the source code for known working programs (Apple supplies 'cu', 'uucp', and similar programs in source form), or finding a book or guide online, such as: to use as a starting point on UNIX serial programming, since you probably at least have your baud rate set wrong. Note that the above referenced material plays things a little loose with standards-controlled definitions, but has good UNIX programming information. This email sent to site_archiver@lists.apple.com
participants (1)
-
Terry Lambert