Ne, psal jsem v prvnim prispevku:<br>Testoval
jsem ten prenos kdyz byly veskere ostatni preruseni zakazane, zadny program
krome nekonecne smycky se nevykonaval, nic jineho to zpozdit nemuze.<br>KM<br><br><div class="gmail_quote">2011/2/28 Tomas Chvatal <span dir="ltr"><<a href="mailto:tchvatal@ezop.cz">tchvatal@ezop.cz</a>></span><br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div 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" target="_blank">www.ezop.cz</a><br><a href="mailto:tchvatal@ezop.cz" target="_blank">tchvatal@ezop.cz</a><br></div>
<blockquote style="padding-right: 0px; padding-left: 5px; margin-left: 5px; border-left: 2px solid rgb(0, 0, 0); margin-right: 0px;">
<div style="font: 10pt arial;">----- Původní zpráva ----- </div>
<div style="background: none repeat scroll 0% 0% rgb(228, 228, 228); font: 10pt arial;"><b>Od:</b> <a title="karel.minarcik@gmail.com" href="mailto:karel.minarcik@gmail.com" target="_blank">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" target="_blank">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><div></div><div class="h5">
<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 style="font-size: 10pt; color: black; font-family: 'Courier New';" lang="EN-US">;</span><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-US"></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" target="_blank">konfera@efton.sk</a>></span><br>
<blockquote class="gmail_quote" style="padding-left: 1ex; margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204);">
<div>----- Original Message
---------------<br>>Uvnitr<br>>preruseni zakazu globalni preruseni
(cli)<br><br></div>
<div>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" target="_blank">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>
</div></div><p>
</p><hr><div class="im">
<p></p>_______________________________________________<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" target="_blank">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>
</div></blockquote></div>
<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>
<br></blockquote></div><br>