请教LPC1114驱动SD卡的问题

2019-03-25 20:44发布

LPC1114, ZLG的那个板, 用的是 P0.3 - CS P0.6 - SCK P0.8 - MISO P0.9 - MOSI 用的是TKstudio   SSP那部分驱动过595, 没问题, 但不能驱动SD卡, SD驱动部分是ZLG的SD卡驱动, 在其基础上更改的 代码如下: void  SSP_Init (void)
{
 int i;
 PRESETCTRL &= (0x1<<0);
 for(i=0; i<100; i++);
     PRESETCTRL      |= 0x01;                                            /*  禁止SPI0复位                */     IOCON_SCKLOC     = 0x02;                                            /*  P0.6配置为SCK               */
    SYSAHBCLKCTRL   |= (1ul << 11);                                     /*  打开SPI0外设                */
    SSP0CLKDIV       = 0x01;                                            /*  SSP时钟分频                 */
  
    SSP0CR0 = (0x07 << 8) |                                             /*  SCR  设置SPI时钟分频        */
              (0x00 << 7) |                                             /*  CPHA 时钟输出相位,          */
                                                                        /*  仅SPI模式有效               */
              (0x01 << 6) |                                             /*  CPOL 时钟输出极性,          */
                                                                        /*  仅SPI模式有效               */
              (0x00 << 4) |                                             /*  FRF  帧格式 00=SPI,01=SSI,  */
                                                                        /*  10=Microwire,11=保留        */
              (0x07 << 0);                                              /*  DSS  数据长度,0000-0010=保留*/
                                                                        /*  0011=4位,0111=8位,1111=16位 */     SSP0CR1 = (0x00 << 3) |                                             /*  SOD  从机输出禁能,1=禁止    */
              (0x00 << 2) |                                             /*  MS   主从选择,0=主机,1=从机 */
              (0x01 << 1) |                                             /*  SSE  SSP使能                */
              (0x00 << 0);                                              /*  LBM  回写模式               */
            
    SSP0CPSR = 2;                                                       /*  PCLK分频值                  */
    SSP0ICR  = 0x03;                                                    /*  中断清除寄存器              */
}     此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。