RE: Queued SCI with Interrupts on MPC555
"David Eicher" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <[email protected]> |
Hi Allan,
Thanks much for this input!
Let me make sure I understand:
You recommend reading from the SC1SR and SC1DR because this can effect the
transmit queued behavior?
So to start transmission you set QBHEI and call the ISR.
In the Tx ISR then you check to see if QBHE flag is set? Do you set the wrap
each time? Do you find that you have to set QTE in the ISR each time?
So you are using only the bottom half interrupt and flag. I have tried and
tried to get that to work, it just will not transmit for me. I've tried
using both flag/interrupts, and just bottom half.
I use this code to initiate transmit (QBHEI is already set):
for (i=0;i<16;i++) scratch[i] = 'a';
ioctl(QSMCM_QSCI1, QSCI_ENABLE_TX_WRAP, SCI_ENABLE);
ioctl(QSMCM_QSCI1, QSCI_WRITE_QUEUE_TX_SIZE, 16);
/* read SR with TC set */
while(!(ioctl(QSMCM_SCI1, SCI_GET_FLAGS, SCI_TX_COMPLETE))) {;}
/* fill the whole buffer */
write(QSMCM_QSCI1, QUEUE_TOP_HALF, scratch, 16);
/* Clear top half and bottom half flags QTHE/QBHE */
ioctl(QSMCM_QSCI1, QSCI_CLEAR_QUEUE_FLAGS, QSCI_TX_TOP_HALF);
ioctl(QSMCM_QSCI1, QSCI_CLEAR_QUEUE_FLAGS, QSCI_TX_BOT_HALF);
/* Set queued enable flag in control register QTE */
ioctl(QSMCM_QSCI1, QSCI_QUEUE_TX, SCI_ENABLE);
/* Set QSCI transmit enable flag in control register TE */
ioctl(QSMCM_SCI1, SCI_TRANSMITTER, SCI_ENABLE);
Then I use this code in the transmit ISR to continue transmitting:
if (ioctl(QSMCM_QSCI1, QSCI_GET_QUEUE_FLAGS, QSCI_TX_BOT_HALF))
{
ioctl(QSMCM_QSCI1, QSCI_WRITE_QUEUE_TX_SIZE, 16);
ioctl(QSMCM_QSCI1, QSCI_ENABLE_TX_WRAP, SCI_ENABLE); /* set QTWE */
ioctl(QSMCM_QSCI1, QSCI_CLEAR_QUEUE_FLAGS, QSCI_TX_BOT_HALF); /*
clear QBHE */
for (i=0;i<14;i++) scratch[i] = 'c';
scratch[6] = (u_char)13;
scratch[7] = (u_char)10;
write(QSMCM_QSCI1, QUEUE_TOP_HALF, scratch, 16);
ioctl(QSMCM_QSCI1, QSCI_QUEUE_TX, SCI_ENABLE);
}
I expected this to transmit 16 'a' characters followed by 14 'c' characters
and a carriage return/linefeed like this:
Aaaaaaaaaaaaaaaacccccccccccccc
Cccccccccccccc
Cccccccccccccc
Etc.
But what I get is:
Aaaaaaaaaaaaaaaa
That's it, could you compare this code with what you use and see if you spot
anything that is obviously wrong?
Sure appreciate your help, thanks,
Dave
_____
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/dN_tlB/TM
--------------------------------------------------------------------~->
-----------------------------------------------------------
To learn more about Freescale Microcontrollers, please visit
http://www.freescale.com/mcu
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/MPC500/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/