At 09:23 AM 1/20/05 +0000, you wrote:
>Is anyone aware of another way to start the transmit interrupt running on
>the UART on an
>LPC2106 other than writing to the THR?
There isn't another way.
>I'd rather the interrupt routine take care of
>writing to the UART instead of another asynchronous thread of code doing
>that.
Well, one way or another you've got to start the UART going. I haven't run
across a UART that doesn't need to be primed by writing to the transmit
register. (I trust you that they exist, I just don't remember running into
one)
> The hard part is when the software queue runs empty and
>the hardware queue runs empty the interrupt happens but does not persist
>(this might be
>my libel assumption) and when the interrupt routine exits, the THR empty
>status bit is still
>set but there is no more interrupt.
You need to set a flag when both queues have emptied so that the queuing
routine can start up the UART again.
>Now if the software queue is loaded up, to get the
>interrupt to trigger the queue transfer to the hardware queue, I have to
>transfer one value
>to trigger the interrupt to do the rest. In other tx interrupt on other
>micros the interrupt
>persists and you just flip a control register bit and turn it off to block
>the interrupt until
>the software queue is loaded again whereupon you set the bit back on.
I don't see this as substantively different. In one case you write to the
transmit register, in the other the interrupt enable register, but in both
cases you need to set a flag when both queues are empty and respond
accordingly.
For the 16550 style case the routines look something like
transmit ()
{
if( SW queue is empty) {
empty_flag = 1;
}
else {
stuff the 16550 HW queue appropriately
}
}
interrupt_transmit_routine()
{
transmit()
}
queueing_routine( void *ptr, size_t len)
{
Add incoming data to queue
when all data added (or queue filled) {
if( empty_flag != 0) {
disable interrupts
transmit()
restore interrupts
}
}
}
The only difference from the peripheral interrupt enable/disable approach
is the use of the transmit call in the queuing routine rather than a set
interrupt on call (or line). All the rest of the code is necessary anyway.
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, IIIMessage
Re: [lpc2000] transmit interrupt kicker
2005-01-20 by Robert Adsett
Attachments
- No local attachments were found for this message.