Processor Expert config for SD Card - MC9S08AW32

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Processor Expert config for SD Card - MC9S08AW32

2,961 次查看
marcov
Contributor I
Hi guys,
I'm using the SPI bus on the MC9S08AW32 to access to an SD card.

In CodeWarrior I've added through Processor Expert the SPI bus setup in hardware mode. Using the default configuration for master I have some trouble  interfacing with the card.

So can u please tell me if this configuration is right?

regards,
marco











Message Edited by NLFSJ on 2008-05-08 06:21 AM
标签 (1)
0 项奖励
回复
3 回复数

957 次查看
erooll
Contributor II
Hi. marcov, actually I use a SD card like a storage device, even I have implement a FAT file system to store data.
Usually I set all modules of microcontroller writing directly code.
This is my settings that I have used in a GT60, an recently in a QE128
 
 
   SPI1BR = 0x00;       //Baud Rate @ fbus/2   
   SPI1C2 = 0x00;
  
   SPI1C1 = 0b01011100;
    /*        ||||||||-->LSBFE: LSB first
              |||||||--->SSOE: Slave select output enable
              ||||||---->CPHA: Clock Phase
              |||||----->CPOL: Clock Polarity
              ||||------>MSTR: Master/Slave Mode Select
              |||------->SPTIE: SPI Transmit Interrupt Enable
              ||-------->SPE: SPI Sytem Enable
              |--------->SPIE: SPI Interrupt Enable (for SPRF and MODF)
    */           
0 项奖励
回复

957 次查看
Roach
Contributor I

I can see that your shift clock idle polarity is High, I think it has to be low to communicate with SD card. Attached is my PE config.

Message Edited by Roach on 2008-05-15 07:18 PM

 

SD_SPI2.jpg

Message Edited by t.dowe on 2009-10-27 12:36 PM
0 项奖励
回复

957 次查看
marcov
Contributor I
thanks! i will give it a try....

my problem at the moment is that I randomly read a shifted bit, eg 0x04 instead of 0x01.... maybe your hint will solve this.


0 项奖励
回复