USB3.0開發(fā)筆記課件_第1頁
USB3.0開發(fā)筆記課件_第2頁
USB3.0開發(fā)筆記課件_第3頁
USB3.0開發(fā)筆記課件_第4頁
USB3.0開發(fā)筆記課件_第5頁
已閱讀5頁,還剩8頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、20130819 (周一)..2.13.14. CyU3PMemSet (uint8_t *)&io_cfg, 0, sizeof(io_cfg); io_cfg.isDQ32Bit = CyFalse; io_cfg.useUart = CyTrue; io_cfg.useI2C = CyFalse; io_cfg.useI2S = CyFalse; io_cfg.useSpi = CyFalse; io_cfg.lppMode = CY_U3P_IO_MATRIX_LPP_UART_ONLY; /* GPIO 45 is used as

2、 input pin. GPIO 21 is also used but cannot * be selected here as it is part of the GPIF IOs (CTL4). Since * this IO is not used, it can be overridden to become a GPIO by * invoking the CyU3PDeviceGpioOverride call. */ io_cfg.gpioSimpleEn0 = 0; io_cfg.gpioSimpleEn1 = 0x00002000; /* GPIO 45 */ io_cfg

3、.gpioComplexEn0 = 0; io_cfg.gpioComplexEn1 = 0;status = CyU3PDeviceConfigureIOMatrix (&io_cfg);15. /* Configure GPIO 45 as input with interrupt enabled for both edges */ gpioConfig.outValue = CyTrue; gpioConfig.inputEn = CyTrue; gpioConfig.driveLowEn = CyFalse; gpioConfig.driveHighEn = CyFalse;

4、gpioCrMode = CY_U3P_GPIO_INTR_BOTH_EDGE;apiRetStatus = CyU3PGpioSetSimpleConfig(45, &gpioConfig);16. /* Override GPIO 21 as this pin is associated with GPIF Control signal. * The IO cannot be selected as GPIO by CyU3PDeviceConfigureIOMatrix call * as it is part of the GPIF IOs. Override

5、 API call must be made with * caution as this will change the functionality of the pin. If the IO * line is used as part of GPIF and is connected to some external device, * then the line will no longer behave as a GPIF IO. Here CTL4 line is * not used and so it is safe to override. */ apiRetStatus =

6、 CyU3PDeviceGpioOverride (21, CyTrue); /* Configure GPIO 21 as output */ gpioConfig.outValue = CyFalse; gpioConfig.driveLowEn = CyTrue; gpioConfig.driveHighEn = CyTrue; gpioConfig.inputEn = CyFalse; gpioCrMode = CY_U3P_GPIO_NO_INTR;apiRetStatus = CyU3PGpioSetSimpleConfig(21, &gpioConfig

7、);17. /* Callback funtion for the DMA event notification */voidCyFxUartLpDmaCallback ( CyU3PDmaChannel *chHandle, /* Handle to the DMA channel. */ CyU3PDmaCbType_t type, /* Callback type. */ CyU3PDmaCBInput_t *input) /* Callback status. */ CyU3PReturnStatus_t status; if (type = CY_U3P_DMA_CB_PROD_EV

8、ENT) /* This is a produce event notification to the CPU. This notification is * received upon reception of every buffer. The buffer will not be sent * out unless it is explicitly committed. The call shall fail if there * is any application error. */ status = CyU3PDmaChannelCommitBuffer (chHandle, in

9、put->buffer_p.count, 0); if (status != CY_U3P_SUCCESS) CyFxAppErrorHandler (status); 18. 需要掌握的usb固件,有實現(xiàn)FIFO訪問模式的數(shù)據(jù)傳輸例子 和實現(xiàn)vendor requests到IIC訪問的例子和實現(xiàn)vendor requests到GPIO模擬的SPI訪問例子201309011. 今天開始測試直接在開發(fā)板上跑通上述三個案例。2. 首先是IIC register mode調(diào)試,固件非常完整,可以實現(xiàn)iic到eeprom的訪問。但是訪問來自于CY_U3P_USB_VENDOR_RQT,這個指令需

10、要上位控制界面發(fā)送出來。 /* Decode the fields from the setup request. */ bReqType = (setupdat0 & CY_U3P_USB_REQUEST_TYPE_MASK); bType = (bReqType & CY_U3P_USB_TYPE_MASK); bTarget = (bReqType & CY_U3P_USB_TARGET_MASK); bRequest = (setupdat0 & CY_U3P_USB_REQUEST_MASK) >> CY_U3P_USB_REQUEST_P

11、OS); wValue = (setupdat0 & CY_U3P_USB_VALUE_MASK) >> CY_U3P_USB_VALUE_POS); wIndex = (setupdat1 & CY_U3P_USB_INDEX_MASK) >> CY_U3P_USB_INDEX_POS);wLength = (setupdat1 & CY_U3P_USB_LENGTH_MASK) >> CY_U3P_USB_LENGTH_POS);調(diào)試界面上,bRequest=0xba, case CY_FX_RQT_I2C_EEPROM_WRIT

12、E:, bRequest=0xbb, case CY_FX_RQT_I2C_EEPROM_READ:,wValue i2cAddr = 0xA0 | (wValue & 0x0007) << 1); , CyFxUsbI2cTransfer (wIndex, i2cAddr, wLength, wIndex= iic register address, 16bit;wLength = 64, 3. 然后是SPI GPIO register mode,使用GPIO作為SPI管腳的模式。bRequest=0xc2, CY_FX_RQT_SPI_FLASH_WRITE, bReq

13、uest=0xc3, CY_FX_RQT_SPI_FLASH_READ,bRequest=0xc4, CY_FX_RQT_SPI_FLASH_ERASE_POLL,wValue 在 erase模式下 (wValue) ? CyTrue : CyFalsewIndex =pageAddress for FLASH經(jīng)過測試,產(chǎn)生錯誤報告,應該是由于開發(fā)板上并不存在gpio口連接到了SPI flash上面。故而改為SPI register mode, 使用CY3014指定的SPI口連接到flash芯片。調(diào)試有反應,但是數(shù)據(jù)返回錯誤,重新返回詳讀flash操作手冊。 flash的寫入需要首先進行erase,然后才可以進行寫入。這是器件的物理特性決定的,所有調(diào)試的時候也是要先erase該sector。4. 接下來需要調(diào)試的是bulk數(shù)據(jù)傳輸模式。5. Flag A和Flag B的意思做一個FPGA到PPort的最簡單的寫入邏輯,if(flag_a) n_sl_wr<=0;6. 官方給出的cmos直接到GPIF 的狀態(tài)機:USB video class(又稱為USB video device class or UVC)就是USB dev

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論