Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).
trouble with S12XS SCI controller - ben_smida_hamdi - Apr 9 7:02:35 2009
i'm developing an uart driver based on interrupts.
i've realized that when executing the ISr software failed to reset TDRE Flag.i made sure
tha i've followed all steps listed in the datasheet to do so which are:
1-reading the SCI Status Register.
2-Writing to the SCI Data Low register.
but the ISR Continue to go in Loop.
i wish tha anyone could help me figure this out.
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
RE: trouble with S12XS SCI controller - jpdi - Apr 9 8:23:38 2009
Flollowing an extract of the code I use for SCI.
When I send datas, via a buffer :
SCI1DRL =3D data to send...
SCI1CR2 |=3D 0x88; // enable interrupt on Xmit buffer empty
//***********************************************************************
void SCI1_Init (Word baudrate, Byte sysclk)
{ SCI1BDH =3D // your value for speed
SCI1BDL =3D // your value for speed
SCI1CR1 =3D 0x00;
SCI1CR2 =3D 0x2c; // enable xmit/receive, int on receive only
}
//************************************************************************
#pragma interrupt_handler ISR_Sci1
void ISR_Sci1 (void)
{ unsigned char sci_status;
sci_status =3D SCI1SR1;
// Interruption on receive buffer full
if (sci_status & 0x28) // RDRF 0x20 : Receive data register full
{ // Your code for reception
}
// Interruption on xmit buffer empty
if (sci_status & 0x80) // TDRE : 0x80 ; Transmit Data Register
Empty
{ // Your code for transmission
if (/* your condition for xmit not finished */)
{ SCI1DRL =3D .../...
}
else // nothing else to xmit
{ SCI1CR2 &=3D 0x3f; // disable xmit interrupt
}
}
}
Best regards.
Joel
-----Message d'origine-----
De=A0: 6...@yahoogroups.com [mailto:6...@yahoogroups.com] De la part de
ben_smida_hamdi
Envoy=E9=A0: jeudi 9 avril 2009 13:02
=C0=A0: 6...@yahoogroups.com
Objet=A0: [68HC12] trouble with S12XS SCI controller
i'm developing an uart driver based on interrupts.
i've realized that when executing the ISr software failed to reset TDRE
Flag.i made sure tha i've followed all steps listed in the datasheet to do
so which are:
1-reading the SCI Status Register.
2-Writing to the SCI Data Low register.
but the ISR Continue to go in Loop.
i wish tha anyone could help me figure this out.
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )
Re: trouble with S12XS SCI controller - David Armstrong - Apr 9 9:07:18 2009
If you want to get S12X SCI interrupt info, go to my site at:
http://mamoru.tbreesama.googlepages.com/
I have a page explaining how to do interrupts with the S12X, using the SCI
as an example. Furthermore, the code source I have posted includes a
working, tested, and verified SCI interrupt handler. (In assembly, of
course.) Of course, this is with the S12XD, but I assume it should be
similar/identical for the S12XS.
Have Fun!
Dave
On Thu, Apr 9, 2009 at 5:02 AM, ben_smida_hamdi
wrote:
> i'm developing an uart driver based on interrupts.
> i've realized that when executing the ISr software failed to reset TDRE
> Flag.i made sure tha i've followed all steps listed in the datasheet to do
> so which are:
>
> 1-reading the SCI Status Register.
> 2-Writing to the SCI Data Low register.
>
> but the ISR Continue to go in Loop.
>
> i wish tha anyone could help me figure this out.
>
>
>
[Non-text portions of this message have been removed]
------------------------------------
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )Re: trouble with S12XS SCI controller - ben_smida_hamdi - Apr 9 12:09:49 2009
thanks for ur help.I guess i've catched a wrong address of the SCICR2 when trying to
disable Tx interrupt in the ISR before exiting it.
Now it is working.but i am having another situation,i am using a service PUT_Byte_Exe
which puts a byte in Tx Buffer(circular buff)
then enables TDRE Flag INT request so as the interruption could directly handle sending
this Byte.but what if i'm exiting the ISR and calling this service again ?? i've found
that data will be overwritten cause when enabling Tx Interrupt(TIE = 1) TDRE will be set
to 1 regardless of previous data has been already sent or not.
------------------------------------

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )