Re: Queued SCI with Interrupts on MPC555

"qty154" <[email protected]>
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <[email protected]>
Hello!

I managed to do the job, altough it took approx. 6-8 months.
Here is a pseudocode I used. I don't say it's 100% OK, sometimes the Q 
stops sending, but it may depend on the layer above, i.e. the task 
which puts the messages to send out to its own buffer and feeds the OS 
Q handler which also has a 256-byte ring buffer.
I wrote it to Jeff, I hope it works to him, I didn't hear of him since 
then ...
Your latest problem can depend on that if you are not fast enough with 
the ISR, the last byte can go out (while you are in the ISR) and that 
resets the QTE.

Hello Jeff!

First here are the conditions I use for the receive
and transmit Q interrupts. Both have 4 states inside.
I think the order to recognise the states is
important!

## Q receive interrupt occured if
##      (QRE & (QTHF | QBHF)) | IDLE | QOR | RDRF

## state1 = QRE & (QTHF | QBHF)
## state2 = QOR
## state3 = IDLE
## state4 = RDRF

## Q transmit interrupt occured if
##      TC  | (QTE & QTHE & QTHEI) | (QTE & QBHE &
QBHEI)

## state1 = TC
## state2 = QTE & QTHE
## state3 = QTE & QBHE
## state4 = QTHE & QBHE

In case of transmit I do the following:
state4 Both QTHE and QBHE, but not yet TC. Disable,
clear them and wait for TCI.
state1 disable Q and transmitter if nothing more to
send, otherwise reinitialise from the beginning.

state2&3 are more complicated, lets see them
(roughfly, you have to finalise yourself).
state2 QTHE:
I set QTHEI and QBHEI depending it more than 8 or more
than 16 bytes left to send.
QTSZ = number of bytes -1, max 15
Copy max 8 bytes to Q
set QTE & QTWE
state3 QBHE
set QTHEI&QBHEI&QTWE if QTSZ=15, otherwise clear them.
fill Q with max 8 bytes.

Just some trick: Make sure your routine works if for
example QTHE happens but you don't have time to serve
this interrupt before QBHE also happens! And they can
happen any time, even in the ISR! I first read out ALL
QSCI flags I need in the ISR into the flags (CR) and
then I analyse them and set the control flags
accordingly.

best regards
Attila


--- In [email protected], "David Eicher" <sailors3@c...> wrote:
>
> Hello,
> 
>  
> 
> Anyone have any experience with the subject matter? I've followed 
the
> examples in the demo code in the quickstart package, the top half 
and bottom
> half interrupts/flags just don't seem to work they way they suggest. 
The
> users manual for MPC555 doesn't give a lot of detail, but I have not
> succeeded in transmitting a string of bytes using interrupts yet. 
Using a
> polling method I was able to get transmit working using the 
transmission
> queue.
> 
>  
> 
> Thanks for any help you might be able to offer,
> 
>  
> 
> Dave
> 
>  
> 
> 
> 
> [Non-text portions of this message have been removed]
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.