RE: MPC565 Queued SCI receive problem

"Dobbin Allan-r11834" <[email protected]> Mon, 31 Jul 2006 12:51:48 -0700
Newsgroups gmane.comp.hardware.motorola.microcontrollers
Message-ID <4147ED8B92A864498825C07E53594E4AD48956@az33exm20.fsl.freescale.net>
I think you can read the RAF flag within your IDLE handler - if RAF is
set, then another character is incoming and you take some kind of
alternate action.  I'm not sure what the alternative action should be
since I'm not certain why setting then clearing QRE makes you miss the
incoming byte.
 
Even this suggestion of checking RAF may not be sufficient as you may
still miss the byte if you just happen to read RAF a couple of clocks
before the byte starts.  A better suggestion is to update your ISR so
that you never have to clear the queue i.e. if you get an IDLE
interrupt, empty the queue and clear IDLE as you've done, but don't
bother resetting the logic.  Instead, set a static software flag and
exit the ISR.  Next time you enter the ISR, if the flag is set, go ahead
and clear it, but this tells you that you don't start from 0 (or 8) when
you get a top or bottom half interrupt as follows :
 
if (IDLE) ....   LastTimeWasIdle = 1;  LastQueuePointer = SR.B.QRPNT;
 
 
if (QTHF)
{
if (LastTimeWasIdle ) start=LastQueuePointer; else start=0;
for (i=start; i<8; i++).......
}
 
if (QBHF)
{
if (LastTimeWasIdle ) start=LastQueuePointer; else start=8;
for (i=start; i<16; i++).......
}
LastTimeWasIdle = 0;
 
You'd have to try this to see if it works, but this may be an
improvement as you never reset the queue and hopefully therefore never
miss any chacters.
 
A couple other points:
- set ILT=1 so you are not getting false IDLE interruptions.
- you are reading all 16 of the queue data registers to clear IDLE.  I
think all you have to do is to read any one of them and you already do
this in enquei function.  So please try removing the 16 reads of SCRQ[i]
and test that IDLE is still cleared.
 
- Allan
 
 
 

	-----Original Message-----
	From: [email protected] [mailto:[email protected]] On
Behalf Of [email protected]
	Sent: Monday, July 31, 2006 1:25 PM
	To: [email protected]
	Subject: [MPC500] MPC565 Queued SCI receive problem
	
	

	Dear group,
	
	I have been using the MPC565?s QSCI receive queue successfully
for some 
	time.
	I run at 115,200 baud. Recently I have come across a situation
that causes 
	it to fail. 
	If a packet of characters contains at least one intercharacter
delay of 
	just over one 
	character time the idle interrupt occurs just prior to the next
receive 
	character arrival.
	When executing the idle ISR the queue is cleared with this
received 
	character. 
	Does anyone have any idea how I can fix this problem? My code is
as 
	follows:
	
	void imb_IRQ1_ISR (void)
	{ /* SCI_A interrupts (Com1,Com2) */
	U16 status;
	U08 sciData,i;
	
	//Com1
	status = QSMCM_A.SC1SR.R; /* check Com1 QSMCM 'A' SCI 1 */
	if(QSMCM_A.QSCI1SR.B.QTHF)
	{
	QSMCM_A.QSCI1SR.B.QTHF = 0; /* clear QTHF bit */
	for(i = 0; i < 8; i++)
	{
	RxCount1++;
	enquei(Com1RxQ, (U08)QSMCM_A.SCRQ[i].R);
	}
	Com1QueRxNextFramePointer = 8;
	}
	if(QSMCM_A.QSCI1SR.B.QBHF)
	{
	QSMCM_A.QSCI1SR.B.QBHF = 0; /* clear QBHF bit */
	for(i = 8; i < 16; i++)
	{
	RxCount1++;
	enquei(Com1RxQ, (U08)QSMCM_A.SCRQ[i].R);
	}
	Com1QueRxNextFramePointer = 0;
	}
	if(QSMCM_A.SC1SR.B.IDLE)
	{
	for(i = Com1QueRxNextFramePointer; i < QSMCM_A.QSCI1SR.B.QRPNT;
i++)
	{
	RxCount1++;
	enquei(Com1RxQ, (U08)QSMCM_A.SCRQ[i].R);
	}
	for(i=0; i<16; i++) /* clear IDLE bit */
	sciData = QSMCM_A.SCRQ[i].R;
	QSMCM_A.QSCI1CR.B.QRE = 0; /* Clear then Set QRE to reset QRPNT
*/
	QSMCM_A.QSCI1CR.B.QRE = 1;
	Com1QueRxNextFramePointer = 0;
	}
	if (status&0x000F)
	{
	ComErrors[0] |= status&0x000F;
	sciData = (char)QSMCM_A.SC1DR.R; /* clear status register */
	RxErrorCount1++;
	}
	}
	
	Best Regards,
	
	Peter Santariello
	Software Engineer
	INFICON
	2 Technology Place
	East Syracuse, NY 13057
	+1.315.434.1150 (voice)
	+1.315.434.1273 (fax)
	[email protected]
<mailto:Peter.Santariello%40inficon.com>  (e-mail)
	http://www.inficon.com <http://www.inficon.com> 
	
	
***********************************************************************
	NOTICE: - This message including any attachments is intended
only for the 
	use of the designated recipient(s) named above and may contain 
	confidential information protected by law. If you are not the
intended 
	recipient, you are hereby notified that any disclosure, copying,

	distribution, or the taking of any action in reliance on the
contents of 
	this information is strictly prohibited. If you have received
this 
	transmission in error, please notify the sender immediately by
e-mail and 
	delete the original message including any attachments.
	
*********************************************************************** 
	
	[Non-text portions of this message have been removed]
	
	

	 



[Non-text portions of this message have been removed]



-----------------------------------------------------------
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/