Is it possible to set the LPC21xx uart to interrupt only when a character with bit 9 set (parity=1) is received? I'm looking at the LPC2138 spec, for example, and I don't a way to do this. Many microcontrollers can do this and the LPC uart is very complete so I thought this may be possible. Is there a way? |
|
UART Interrupt On Bit 9?
Started by ●February 15, 2005
Reply by ●February 15, 20052005-02-15
At 10:46 PM 2/15/05 +0000, Chris wrote: >Is it possible to set the LPC21xx uart to interrupt only when a >character with bit 9 set (parity=1) is received? I'm looking at the >LPC2138 spec, for example, and I don't a way to do this. > >Many microcontrollers can do this and the LPC uart is very complete so >I thought this may be possible. Is there a way? There is a technique I've used on standard PC serial ports ('550 based) that I would expect to work called parity modulation. The idea is to use two 8 bit + parity modes, 8 bit + mark and 8 bit + space. The parity bit becomes your 9'th bit. By interrupting only on a parity mismatch you get the equivalent of an interrupt on 9'th bit set. As with 9 bit mode you can then examine the character received and decide to go to full reception or continue waiting for the next parity mismatch. I have not tried this on an LPC and I don't know if there are any dark corners in the UART that might give trouble (interactions with the FIFO might need to be checked). I hope that's clear. Robert " 'Freedom' has no meaning of itself. There are always restrictions, be they legal, genetic, or physical. If you don't believe me, try to chew a radio signal. " Kelvin Throop, III |
Reply by ●February 16, 20052005-02-16
A small word of warning on using this technique... I was involved in a
product that used the maniuplation of the parity mode to fake up the 9th bit and it worked fine when it was running from a state machine under interrupt control in DOS but when we went to WIN32 and we had to use the device driver and had the FIFO on it quickly decended into the pit of hell. All sorts of timing issues cropped up as you had to be sure that the character had gone before you changed the parity control bits and you were never really sure so we inserted delays. This affected the performance and it also made it very machine specific and we used to end up endlessly tuning things... Really a Win32 device driver is the only solution and that was a fairly major project... I don't wish to be a sayer of doom but do use some caution with this approach especially if you want to run it on different platforms and machines. -----Original Message----- From: Robert Adsett [mailto:] Sent: Wednesday, 16 February 2005 7:02 AM To: Subject: Re: [lpc2000] UART Interrupt On Bit 9? At 10:46 PM 2/15/05 +0000, Chris wrote: >Is it possible to set the LPC21xx uart to interrupt only when a >character with bit 9 set (parity=1) is received? I'm looking at the >LPC2138 spec, for example, and I don't a way to do this. > >Many microcontrollers can do this and the LPC uart is very complete so >I thought this may be possible. Is there a way? There is a technique I've used on standard PC serial ports ('550 based) that I would expect to work called parity modulation. The idea is to use two 8 bit + parity modes, 8 bit + mark and 8 bit + space. The parity bit becomes your 9'th bit. By interrupting only on a parity mismatch you get the equivalent of an interrupt on 9'th bit set. As with 9 bit mode you can then examine the character received and decide to go to full reception or continue waiting for the next parity mismatch. I have not tried this on an LPC and I don't know if there are any dark corners in the UART that might give trouble (interactions with the FIFO might need to be checked). I hope that's clear. Robert " 'Freedom' has no meaning of itself. There are always restrictions, be they legal, genetic, or physical. If you don't believe me, try to chew a radio signal. " Kelvin Throop, III Yahoo! Groups Links -- This email is confidential and intended solely for the use of the individual to whom it is addressed. Any views or opinions presented are solely those of the author and do not necessarily represent those of NAUTRONIX LTD. If you are not the intended recipient, you have received this email in error and use, dissemination, forwarding, printing, or copying of this email is strictly prohibited. If you have received this email in error please contact the sender. Although our computer systems use active virus protection software, and we take various measures to reduce the risk of viruses being transmitted in e-mail messages and attachments sent from this company, we cannot guarantee that such e-mail messages and attachments are free from viruses on receipt. It is a condition of our using e-mail to correspond with you, that any and all liability on our part arising directly or indirectly out of any virus is excluded. Please ensure that you run virus checking software on all e-mail messages and attachments before reading them. |