3 Replies Latest reply on Sep 6, 2019 1:50 AM by thsh_4007911

    FX3SMassStorage例程中CyU3PSibQueryDevice()返回0x68

    thsh_4007911

      Hi,

           在我们的板子上通过CyUSB3035来访问MicroSD插槽(只有一个),VIO2提供3.3V电压。

           其中,MicroSD的引脚如下图:

          

           我将FX3SMassStorage例程修改后,下载到CyUSB3035中运行,调试信息返回“StorageQueryDev (0) failed with code 0x68”。

           FX3SMassStorage例程主要修改如下:

           1、#define LOG_ENABLE

       

           2、int main(void)

          /* Configure the IO matrix for the device.
           * S0 port is enabled in 8 bit mode.
           * S1 port is enabled in 4 bit mode.
           * UART is enabled on remaining pins of the S1 port.
           */
          io_cfg.isDQ32Bit        = CyFalse;
          io_cfg.s0Mode           = CY_U3P_SPORT_4BIT;
      
      
      #ifdef LOG_ENABLE
          /* If the UART is used for logging, we can only configure the S1 port as 4 bits wide. */
          io_cfg.s1Mode           = CY_U3P_SPORT_INACTIVE;
          io_cfg.lppMode          = CY_U3P_IO_MATRIX_LPP_UART_ONLY;
          io_cfg.useUart          = CyTrue;
      #else
          io_cfg.s1Mode           = CY_U3P_SPORT_8BIT;
          io_cfg.lppMode          = CY_U3P_IO_MATRIX_LPP_NONE;
          io_cfg.useUart          = CyFalse;
      #endif
      
      
          io_cfg.gpioSimpleEn[0]  = 0;
          io_cfg.gpioSimpleEn[1]  = 0;//x02102800;                       /* IOs 43, 45, 52 and 57 are chosen as GPIO. */
          io_cfg.gpioComplexEn[0] = 0;
          io_cfg.gpioComplexEn[1] = 0;
          io_cfg.useI2C           = CyFalse;
          io_cfg.useI2S           = CyFalse;
          io_cfg.useSpi           = CyFalse;
      
      
          status = CyU3PDeviceConfigureIOMatrix (&io_cfg);
          if (status != CY_U3P_SUCCESS)
          {
              goto handle_fatal_error;
          }
      

       

           3、void CyFxMscApplnSibInit (void)

          intfParams.resetGpio       = 0xFF;                          /* No GPIO control on SD/MMC power. */
          intfParams.rstActHigh      = CyTrue;                        /* Don't care as no GPIO is selected. */
          intfParams.cardDetType     = CY_U3P_SIB_DETECT_DAT_3;       /* Card detect based on SD_DAT[3]. */
          intfParams.voltageSwGpio   = 0xFF;                          /* Use GPIO_45 for voltage switch on S0 port. */
          intfParams.lvGpioState     = CyFalse;                       /* Driving GPIO low selects 1.8 V on SxVDDQ. */
          intfParams.writeProtEnable = CyFalse;                       /* Write protect handling enabled. */
          intfParams.lowVoltage      = CyFalse;                        /* Low voltage operation enabled. */
          intfParams.useDdr          = CyTrue;                        /* DDR clocking enabled. */
          intfParams.maxFreq         = CY_U3P_SIB_FREQ_104MHZ;        /* No S port clock limitation. */
          intfParams.cardInitDelay   = 0;                             /* No SD/MMC initialization delay required. */
      
      
      status = CyU3PSibSetIntfParams (0, &intfParams);
      if (status != CY_U3P_SUCCESS)
      {
      AppDebugPrint (4, "Set S0 SIB interface parameters failed, code=0x%x\r\n", status);
      CyFxAppErrorHandler (status);
      }
      
      
          status = CyU3PSibStart ();
          if (status != CY_U3P_SUCCESS)
          {
              AppDebugPrint (4, "SIB start failed, code=0x%x\r\n", status);
              CyFxAppErrorHandler (status);
          }
      

       

           可以识别到大容量存储设备,但是无法连接到SD卡。