die config der PINs wird in der config_mmc.bas gemacht.
Benutzt du Hardware-SPI oder Software-SPI?
Ich benutze HW-SPI und die config schaut bei mir so aus:
Ich habe auch noch einen 10uF Kondensator direkt am SD-Kartenslot da ich sonst mit manchen Karten Probleme hatte. (aber ich glaube das war dann schon bei der Initialisierung)Code:' --------- Start of Section for HW-SPI ---------------------------------------- ' define Chip-Select Pin Config Pinb.4 = Output ' define here Pin for CS of MMC/SD Card Mmc_cs Alias Portb.4 Set Mmc_cs ' Define here SS Pin of HW-SPI of the CPU (f.e. Pinb.0 on M128) Config Pinb.4 = Output ' define here Pin of SPI SS Spi_ss Alias Portb.4 Set Spi_ss ' Set SPI-SS to Output and High por Proper work of ' SPI as Master ' HW-SPI is configured to highest Speed Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = High , Phase = 1 , Clockrate = 16 , Noss = 1 'Spsr = 1 ' Double speed on ATMega128 Spiinit ' Init SPI ' --------- End of Section for HW-SPI ------------------------------------------
Jetzt funktioniert das ganze stabil und zuverlässig.







Zitieren

Lesezeichen