Gecko3 - CCC Event Weblog
Gecko3 - CCC Event Weblog
Gecko3 - CCC Event Weblog
Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.
YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.
E. Quellcode<br />
132 }<br />
for ( i = 0 x0000 ; i < 5 1 0 ; i++ ) // l oop SPI Flash data to EP6IN<br />
{<br />
EXTAUTODAT2 = readBlock ( ) ; // w r i t e data b y t e from SPI Flash to<br />
d e s t i n a t i o n a d r e s s<br />
EXTAUTODAT2 = lastBlockRead ( ) ; // w r i t e data b y t e from SPI Flash to<br />
d e s t i n a t i o n a d r e s s<br />
SYNCDELAY;<br />
EP4BCH = 0 x02 ;<br />
137 SYNCDELAY;<br />
EP4BCL = 0 x00 ;<br />
s p i f l a s h a d d r e s s =0x200 ;<br />
}<br />
f l a s h r d e n = 0 ;<br />
142 }<br />
// arm EP6IN<br />
void b o o t l o a d c f g ( void )<br />
{<br />
BOOL busy ; // v a i a b l e f o r busy check<br />
147 WORD i ; // counter f o r s t a r t u p sequence<br />
unsigned long a d d r e s s = 0 , counter ; // s t a r t a d r e s s f o r read i n s t r u c t i o n , b y t e<br />
counter<br />
// Read t h e s w i t c h to d e t e c t in witch address range t h e c o n f i g u r a t i o n s h o u l d be<br />
w r i t t e n<br />
i f ( s w i t c h r d ( ) == highaddr memory range )<br />
{<br />
152 l e d w r (0 x06 ) ;<br />
a d d r e s s = 0 x100000 ;<br />
}<br />
GPIFIDLECTL &= 0xF9 ; // b r i n g CS B , RDWR B low<br />
157 PA5 = 0 ; // b r i n g Prog B low b r i n g s t h e d e v i c e in t h e i n i t a l i s a t i o n mode<br />
// and h o l d i t t h e r e<br />
PA5 = 1 ; // b r i n g Prog B b i t h i g h<br />
162 while (PA4 == 0) // i f I n i t B goes h i g h t h e d e v i c e i s in t h e c o n f i g u r a t i o n<br />
l o a d mode<br />
{<br />
;<br />
}<br />
167 IOB = startBlockRead ( a d d r e s s ) ; // d r i v e Port B with f i r s t data b y t e<br />
GPIFIDLECTL &= 0xFE ; // b r i n g CCLK low<br />
GPIFIDLECTL |= 0 x01 ; // b r i n g CCLK h i g h<br />
172 for ( counter = 0 ; counter < ( f i l e s i z e −2) ; counter++)<br />
{<br />
IOB = readBlock ( ) ; // d r i v e Port B with data b y t e<br />
GPIFIDLECTL &= 0xFE ; // b r i n g CCLK low<br />
177 GPIFIDLECTL |= 0 x01 ; // b r i n g CCLK h i g h<br />
// check f o r busy<br />
do<br />
{<br />
182 busy = PA7 ; // read busy b i t<br />
i f ( busy == TRUE)<br />
{<br />
GPIFIDLECTL &= 0xFE ; // b r i n g CCLK low<br />
GPIFIDLECTL |= 0 x01 ; // b r i n g CCLK h i g h<br />
187 }<br />
i f (PA7 == TRUE) // i f DONE i s set , a b o r t t h e busy check because a f t e r<br />
{ // c o n f i g u r a t i o n i s complete t h e DONE b i t has a undefined v a l u e<br />
80 Matthias Zurbrügg, Christoph Zimmermann