ADS8344 an ChipS12

Hallo!

Ich will den AD-Wandler ADS8344 mit dem ChipS12 auslesen (9S12C32).

Ich sage gleich vorweg, da=DF ich ein blutiger Anf=E4nger auf dem SPI-Gebiet bin.

Ich habe nun einen Code gebastelt, bei dem ich der Meinung bin, da=DF er am Ende des folgenden Ausschnittes ein Rechteck-(clock-)Signal am entsprechenden SCK-Ausgang des =B5C messen k=F6nnen m=FCsste. Kann ich aber nicht, er bleibt auf low.

Was mache ich falsch? Solange dieses Clock Signal nicht vom ADC empfangen wird, konvertiert er ja auch nicht und ich stehe dumm da. Ist es ein f=FCr erfahrene SPI-Nutzer sofort erkennbarer Fehler?

~~~~~~~CODE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //Inititalize communication between ADC and =B5C DDRM |=3D 0x38; // set SS,SCK,MOSI lines of the =B5C to Output SPIBR =3D bauddiv; // set SPI Rate

// enable SPI, Master Mode, select clock polarity/phase SPICR1 =3D BM_SPE | BM_MSTR | (cpol ? BM_CPOL : 0) | (cpha ? BM_CPHA :

0); SPICR2 =3D 0; // as default

// Start SPI communication by sending control byte to the ADC PTM =3D PTM & ~0x08; // Bring SS low to select slave SPIDR =3D 0x86; // start transfer with Startbit - ch0 - SGL - external clock while((SPISR & BM_SPIF) =3D=3D 0) ; // wait until transfer finished PTM =3D PTM | 0x08; // Bring SS high to deselect slave ~~~~~~~CODE~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Es ist nat=FCrlich sogar so, da=DF der =B5C in der while-Schleife h=E4ngen bleibt, da ja nunmal keine Kommunikation stattfindet.

Ich bin f=FCr jede Anregung dankbar!

Reply to
1122
Loading thread data ...

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.