Greetings, I am having some problems with the UART protocol. To my limited knowledge, I know that the UART is capable of handling more than the usual 8 data bits. I would need the OMAP to receive 20 bits of data from an external device. My guess is the UART is the most suitable protocol to handle this. However, being 20 data bits, how can I configure the UART code to handle this? I know I need to insert a start and stop bit to make it into a frame but I am not well versed in ANSI C. Any suggestions? Any kind of help would be appreciated. Thanks for looking.
I've seen asynchronous message lengths up to 31 bits that worked just fine using standard baud rate generator chips and crystals. All the ones I've worked with had three bit sync codes which functioned just like a start bit. However, it can't be done with standard asynchronous UART hardware since those insert start and stop bits automatically every
You are talking about some other protocol than a UART, which has 1 start bit, data bits, and 1 or more stop-bits. They use an agreed clock frequency, but have no restrictions on clock phase, or the actual length of the stop period. That phasing/stop period is important in determining the frequency tolerance.
That phasing problem is why most UARTs use a 16x clock signal. They need at least a 2x signal, and that can be very hairy.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at:
It is interesting the odd clock multiples actually give better all round performance than the next higher even multiple. Note that a 2x sampling rate is not actually usable due to the uncertainty when sampling the start bit.
Sampling at 3 times the bit rate gives better performance than 4 times.
That really devolves into where the error budget is applied. The
2x situation requires that the receiver be clocked faster than the sender. When two such communicate one will fail.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at:
Exactly. You might investigate various self-clocking techniques.
Congratulations on learning to use the google interface correctly, and thence how to post correctly. Now you also need to learn to snip the quoted portions that are not germane to your reply, and you will be a first class netizen.
--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at:
wrote: ( Latest post on how to use an OMAP processor's UART to exchange 20bit messages )
As others have pointed out, it is not possible to use a UART the way you need. ( I am surprised at the implicit agreement in previous posts in this thread that there is a UART "protocol". )
The solution is, of course, to design and implement a protocol on top of the UART basic 7-to-9 bits word format to deliver 20 bit messages. (I'll use the term "word" here to refer to the basic
7/8/9 bit data units delivered by a traditional UART)
Using 8-bit words, a trivial implementation could be to encode each 20 bit message as 3-UART-words messages, with 7 bits transmitted in the least significant positions of the 2 first words and 6 in last word. Use the most significant bit as a framing bit, i.e., set it to '1' in the first word of each triplet and '0' in the last two, to identify the beginning of a message. (Some UARTS can be programmed to a 9-bit mode with the fist bit generating a receive interrupt when set. This could simplify your logic, if available)
This will sole the OP problems, and also open a Pandora box of how to deal with, and recover from, communication errors. (For example, you may have to extend the message size to include a CRC, or to keep time stamps on when each word was received, to be able to differentiate between the tree words belonging to a valid message, and a first word from one message +2nd and 3rd from a latter message, with the intermediate ones lost)
I would suggest checking a good book on networking and communication protocols.
Roberto Waltman
[ Please reply to the group, return address is invalid ]
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.