<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.3698" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c0c0c0>
<DIV><FONT size=2>A nemate (treba jen nekdy) povolene preruseni i od jinych
periferii ? Pokud je cpu v preruseni neceho jineho a prijde int. od /SS,
tak</FONT></DIV>
<DIV><FONT size=2>se preruseni od /SS obslouzi az po ukonceni
aktualniho.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV>s přáním hezkého dne / Best regards<BR>Tomáš Chvátal<BR>EZOP Praha
s.r.o.<BR>tel./fax.: 257320853<BR><A
href="http://www.ezop.cz">www.ezop.cz</A><BR><A
href="mailto:tchvatal@ezop.cz">tchvatal@ezop.cz</A><BR></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Původní zpráva ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>Od:</B> <A
title=karel.minarcik@gmail.com href="mailto:karel.minarcik@gmail.com">Karel
Minarčík</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Komu:</B> <A title=hw-list@list.hw.cz
href="mailto:hw-list@list.hw.cz">HW-news</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Odesláno:</B> 28. února 2011 10:05</DIV>
<DIV style="FONT: 10pt arial"><B>Předmět:</B> Re: AVR SPI Slave problem</DIV>
<DIV><BR></DIV>Uplne cely program poslat nemuzu, jen znacne upraveny
vytah:<BR>
<P class=MsoNormal><BR></P>
<P class=MsoNormal>#define TLED_ON PORTD |= (0x80)<BR>#define
TLED_OFF PORTD &= ~(0x80)</P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(63,127,95); FONT-FAMILY: 'Courier New'"><BR></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(63,127,95); FONT-FAMILY: 'Courier New'">void
SPI_Slave_Init(void)<BR>{<BR> DDR_SPI2 =
(1<<MISO2);<BR> SPI2_PORT =
(1<<SCK2)|(1<<MOSI2)|(1<<CS2);<BR> SPCR =
(1<<SPIE)|(1<<SPE)|(1<<MSTR)|(1<<CPOL)|(1<<CPHA);<BR>}</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(63,127,95); FONT-FAMILY: 'Courier New'"><BR></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(63,127,95); FONT-FAMILY: 'Courier New'">//<U>Preruseni</U>
<U>od</U> SPI</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">ISR</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">SPI_STC_vect</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">{</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">uint8_t</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> length =
10;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">uint8_t</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
data;</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: green; FONT-FAMILY: 'Courier New'">uint8_t</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
a;<SPAN> </SPAN></SPAN></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></SPAN> </P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">cli</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">()</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>SPCR = </SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">0<<SPIE</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<SPE</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">0<<MSTR</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<CPOL</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<CPHA</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>TLED_ON;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>SPDR = 0x02</SPAN><SPAN lang=EN-US
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
lang=EN-US style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">do</SPAN></B><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">{</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal style="MARGIN-LEFT: 35.4pt; TEXT-INDENT: 35.4pt"><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">#define</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"> delay
300</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">for</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">a=0;a<delay;a++</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
</SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">if</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">((</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">SPSR&0x80</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">))</SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">break</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN></SPAN></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN><SPAN> ...</SPAN><BR></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
data = SPDR;</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">
SPDR = pole[data];</SPAN><BR><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"></SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P
class=MsoNormal>
.....<BR></P>
<P class=MsoNormal style="TEXT-INDENT: 35.4pt"><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">}</SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">while</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">--length</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN> </P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>TLED_OFF;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>SPCR = </SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<SPIE</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<SPE</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<MSTR</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<CPOL</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">|</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">(</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">1<<CPHA</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">)</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN>sei</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">()</SPAN><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'"><SPAN>
</SPAN></SPAN><B><SPAN
style="FONT-SIZE: 10pt; COLOR: rgb(127,0,85); FONT-FAMILY: 'Courier New'">return</SPAN></B><SPAN
style="FONT-SIZE: 10pt; COLOR: black; FONT-FAMILY: 'Courier New'">;</SPAN><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'">}</SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: 'Courier New'"><BR></SPAN></P>Ve
smycce while je toho samozrejme vice, s problemem to ale nesouvisi. Nektere
veci v kodu jsem pridaval a menil nahodne ze zoufalstvi, nic nepomohlo.<BR>To
zpozdeni jsem zjistoval pomoci LA napichnuteho na SPI + jeden I/O pin AVR jako
signalizace kdy jsem v preruseni.<BR>Problem se vyskytuje uplne nahodne, tj.
treba mnohostokrat do preruseni skocim ihned po shozeni /SS, semtam az po
prijeti jednoho byte.<BR>KM<BR><BR><BR><BR>
<DIV class=gmail_quote>2011/2/28 Jan Waclawek <SPAN dir=ltr><<A
href="mailto:konfera@efton.sk">konfera@efton.sk</A>></SPAN><BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV class=im>----- Original Message
---------------<BR>>Uvnitr<BR>>preruseni zakazu globalni preruseni
(cli)<BR><BR></DIV>
<DIV class=im>To je zbytocne, vyvolanim prerusenia sa automaticky dalsie
prerusenia zakazu (procesor automaticky vynuluje flag I).<BR><BR>>Zjistil
jsem pomoci log. analyzeru ze v AVR se<BR>>vyvolalo preruseni pozde, az
po prijmu prvniho byte a ne hned po shozeni<BR>>/SS.<BR><BR></DIV>Ako
presne ste to zistovali? Mozete poslat
program?<BR><BR>wek<BR><BR><BR><BR>_______________________________________________<BR>HW-list
mailing list - sponsored by <A href="http://www.HW.cz"
target=_blank>www.HW.cz</A><BR><A
href="mailto:Hw-list@list.hw.cz">Hw-list@list.hw.cz</A><BR><A
href="http://list.hw.cz/mailman/listinfo/hw-list"
target=_blank>http://list.hw.cz/mailman/listinfo/hw-list</A><BR></BLOCKQUOTE></DIV><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>HW-list mailing
list - sponsored by
www.HW.cz<BR>Hw-list@list.hw.cz<BR>http://list.hw.cz/mailman/listinfo/hw-list<BR></BLOCKQUOTE></BODY></HTML>