> In light of the previous revelations, I tried what I described before.
> Does anyone know what is going on here ?
>
> Outputting a character into circular buffer works fine like this :
> =======================================
> UINT temp;
>
> /* Handle TX buffer wrap */
temp = (tx_head+1)%RS232_SIZE;
>
> /* Disable TX interrupts */
> U0IER = 0x01;
>
> /* Circ buffer not empty ? */
> if (comm_tx_running)
> {
> comm_tx[tx_head] = (UCHAR)ch;
> tx_head = temp;
> }
> else
> {
> comm_tx_running = 1;
> U0THR = ch;
> }
>
> /* Reenable TX interrupts */
> U0IER = 0x03;
> return (ch);
>
>
> But doing a write to the TX buffer with post increment also causes Default
> IRQs :
> ====================================================
>
> /* Disable TX interrupts */
> U0IER = 0x01;
>
> /* Circ buffer not empty ? */
> if (comm_tx_running)
> {
> comm_tx[tx_head++] = (UCHAR)ch;
> tx_head %= RS232_SIZE;
> }
> else
> {
> comm_tx_running = 1;
> U0THR = ch;
> }
>
> /* Reenable TX interrupts */
> U0IER = 0x03;
> return (ch);
>
> -------------------------------------------------------
>
> Could this have to do with optimisation ?
> I have to honestly volunteer I'm stumped with that one.
>
> -- Kris
I'd second this. I see nothing in here to stop a compiler from
moving stuff around to it's hearts content. You might want
to look at adding some barrier() statements to the above code
to prevent that kind of code rearrangement.
Cheers,
DavidMessage
Re: [lpc2000] UART TX FIFO and INTs problem - SOLVED
2004-02-22 by David Willmore
Attachments
- No local attachments were found for this message.