Forums

HC908GR4/8 SPI interrupt problem

Started by Fred April 10, 2004
The HC908GR4 acts as a SPI slave, the baud rate of the host clock is only
around 5K bps. When the host sends a packet of 8-bytes to the HC908GR4, it
only generate the first Rx interrupt and the ISR only read the first byte.
Then no more interrupt occurs, even on the subsequence packets.

It seems just reading from the Status and Control Register then reading from
the Data Register does not clear the interrupt. Do I have to more?
Anyone seen the same problem?
Or have implemented the SPI interface that works and has sample code?

Please help.

Thanks in advance

Fred



>When the host sends a packet of 8-bytes to the HC908GR4, it >only generate the first Rx interrupt and the ISR only read the first byte. >Then no more interrupt occurs, even on the subsequence packets
Try posting your code so people can see if you are doing something wrong. I downloaded the datasheet and the errata and didn't see any reported problems with the SPI. There might be an app note about implementing SPI.
Hi,
Perhabs, you have not clear the flag in your ISR.
You MUST do this BEFORE read the SPCR.

Yvan
http://www.ybdesign.fr




"Gary Kato" <garykato@aol.com> a &#2013265929;crit dans le message de news:
20040411151116.15383.00000241@mb-m02.aol.com...
> >When the host sends a packet of 8-bytes to the HC908GR4, it > >only generate the first Rx interrupt and the ISR only read the first
byte.
> >Then no more interrupt occurs, even on the subsequence packets > > Try posting your code so people can see if you are doing something wrong.
I
> downloaded the datasheet and the errata and didn't see any reported
problems
> with the SPI. There might be an app note about implementing SPI. > > >
It reads the SPSCR then the SPDR
is that all?
Is there any register to set the EOI?

Thanks is advance

Fred

"YB" <yvan@no_spam_ybdesign.fr> wrote in message
news:c5dkph$m85$1@news.tiscali.fr...
> Hi, > Perhabs, you have not clear the flag in your ISR. > You MUST do this BEFORE read the SPCR. > > Yvan > http://www.ybdesign.fr > > > > > "Gary Kato" <garykato@aol.com> a crit dans le message de news: > 20040411151116.15383.00000241@mb-m02.aol.com... > > >When the host sends a packet of 8-bytes to the HC908GR4, it > > >only generate the first Rx interrupt and the ISR only read the first > byte. > > >Then no more interrupt occurs, even on the subsequence packets > > > > Try posting your code so people can see if you are doing something
wrong.
> I > > downloaded the datasheet and the errata and didn't see any reported > problems > > with the SPI. There might be an app note about implementing SPI. > > > > > > > >
Yes, in C :

SPI isr
{
unsigned char temp ;

    temp = SPSCR ;
    valSPI = SPDR ;
}

That's all !!!


Yvan
http://www.ybdesign.fr




"Fred" <nospam.fpang168@hotmail.com> a &#2013265929;crit dans le message de news:
RlLec.52808$J56.19975@edtnps89...
> It reads the SPSCR then the SPDR > is that all? > Is there any register to set the EOI? > > Thanks is advance > > Fred > > "YB" <yvan@no_spam_ybdesign.fr> wrote in message > news:c5dkph$m85$1@news.tiscali.fr... > > Hi, > > Perhabs, you have not clear the flag in your ISR. > > You MUST do this BEFORE read the SPCR. > > > > Yvan > > http://www.ybdesign.fr > > > > > > > > > > "Gary Kato" <garykato@aol.com> a crit dans le message de news: > > 20040411151116.15383.00000241@mb-m02.aol.com... > > > >When the host sends a packet of 8-bytes to the HC908GR4, it > > > >only generate the first Rx interrupt and the ISR only read the first > > byte. > > > >Then no more interrupt occurs, even on the subsequence packets > > > > > > Try posting your code so people can see if you are doing something > wrong. > > I > > > downloaded the datasheet and the errata and didn't see any reported > > problems > > > with the SPI. There might be an app note about implementing SPI. > > > > > > > > > > > > > > >
It still doesn't work for me. And I ran out of idea.
Thanks very much.

Fred

"YB" <yvan@no_spam_ybdesign.fr> wrote in message
news:c5g8q1$6ni$1@news.tiscali.fr...
> Yes, in C : > > SPI isr > { > unsigned char temp ; > > temp = SPSCR ; > valSPI = SPDR ; > } > > That's all !!! > > > Yvan > http://www.ybdesign.fr > > > > > "Fred" <nospam.fpang168@hotmail.com> a crit dans le message de news: > RlLec.52808$J56.19975@edtnps89... > > It reads the SPSCR then the SPDR > > is that all? > > Is there any register to set the EOI? > > > > Thanks is advance > > > > Fred > > > > "YB" <yvan@no_spam_ybdesign.fr> wrote in message > > news:c5dkph$m85$1@news.tiscali.fr... > > > Hi, > > > Perhabs, you have not clear the flag in your ISR. > > > You MUST do this BEFORE read the SPCR. > > > > > > Yvan > > > http://www.ybdesign.fr > > > > > > > > > > > > > > > "Gary Kato" <garykato@aol.com> a crit dans le message de news: > > > 20040411151116.15383.00000241@mb-m02.aol.com... > > > > >When the host sends a packet of 8-bytes to the HC908GR4, it > > > > >only generate the first Rx interrupt and the ISR only read the
first
> > > byte. > > > > >Then no more interrupt occurs, even on the subsequence packets > > > > > > > > Try posting your code so people can see if you are doing something > > wrong. > > > I > > > > downloaded the datasheet and the errata and didn't see any reported > > > problems > > > > with the SPI. There might be an app note about implementing SPI. > > > > > > > > > > > > > > > > > > > > > > > >