大家好!
我用STM32的USB例程,控制端点都正常,可向ENDP5发命令,我的设备连个ACK都没有,其它的ENDP端点都正常,不知是哪里没设置好,现在为了找原因,只打开EPDP0和ENDP5,请高手指点,谢谢!
#define BTABLE_ADDRESS (0x00)
/* EP0 */
/* rx/tx buffer base address */
#define ENDP0_RXADDR (0x40)
#define ENDP0_TXADDR (0x80)
#define ENDP1_TXADDR (0xC0)
#define ENDP1_RXADDR (0xE0)
#define ENDP2_TXADDR (0x110)
#define ENDP3_TXADDR (0x120)
#define ENDP3_RXADDR (0x140)
#define ENDP4_TXADDR (0x160)
#define ENDP5_TXADDR (0x180)
#define ENDP5_RXADDR (0x1A0)
#define ENDP6_TXADDR (0x1C0)
#define ENDP6_RXADDR (0x1E0)
{
0x09, /* bLength: Configuation Descriptor size */
0x02, /* bDescriptorType: Configuration */
MASS_SIZ_CONFIG_DESC, /* SIZE_CONFIG_DESC*/
0x00,
0x01, /* bNumInterfaces: 3 interface */
0x01, /* bConfigurationValue: */
0x00, /* iConfiguration: */
0x80, /* bmAttributes: */
0x46, /*140=70*2 mA power consumption.*/
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* BUIK_OUT Endpoint,BUIK_IN Endpoint, Interrupt_IN Endpoint*/
0x0B, /* bInterfaceClass: Smart Card Device Class*/
0x00, /* bInterfaceSubClass : without SubClass*/
0x00, /* bInterfaceProtocol: CCID*/
0x00, /* iInterface: Index of string descriptor*/
/*CCID class descriptor*/
0x36, // bLength: CCID Descriptor size 54Bytes
0x21, // bDescriptorType
0x10,0x01, // bcdCCID: CCID Class Spec release number (1.1)
0x00, // bMaxSlotIndex Sim_card,Contact_Card ,Non-contact card
0x07, // bVoltageSupport: 5v,3v,1.8v only support Contact_Card
0x03,0x00,0x00,0x00, // dwProtocols: supports T=0
0xFC,0x0D,0x00,0x00, // dwDefaultClock: 3.58Mhz
0xF0,0x37,0x00,0x00, // dwMaximumClock: 14.32Mhz
0x00, // bNumClockSupported => no manual setting
0x80,0x25,0x00,0x00, // dwDataRate: 9600 bps (0x00002580)
0x29,0x40,0x29,0x00, // dwMaxDataRate: 344105 bps (0x00054029)
0x00, // bNumDataRatesSupported => no manual setting
0xFc,0x00,0x00,0x00, // dwMaxIFSD: 255 (T=1 ) Information Field Size For The Terminal
0x00,0x00,0x00,0x00, // dwSynchProtocols
0x00,0x00,0x00,0x00, // dwMechanical: no special characteristics
0xBA,0x00,0x01,0x00, // dwFeatures:TPDU Level
0x0F,0x01,0x00,0x00, // dwMaxCCIDMessageLength 10+261 : header+Maximun block size
0xFF, // bClassGetResponse
0xFF, // bClassEnvelope
0x00,0x00, // wLcdLayout
0x00, // bPINSupport : no PIN verif and modif
0x01, // bMaxCCIDBusySlots
/* */
0x07, /*Endpoint descriptor length = 7*/
0x05, /*Endpoint descriptor type */
0x85, /*Endpoint address (IN, address 1) */
0x02, /*Bulk endpoint type */
0x20, /*Maximum packet size (32 bytes) */
0x00,
0x00, /*Polling interval in milliseconds */
/* */
0x07, /*Endpoint descriptor length = 7 */
0x05, /*Endpoint descriptor type */
0x05, /*Endpoint address (OUT, address 2) */
0x02, /*Bulk endpoint type */
0x20, /*Maximum packet size (32 bytes) */
0x00,
0x00, /*Polling interval in milliseconds*/
}
/* Initialize Endpoint 5 */
SetEPType(ENDP5, EP_BULK);
SetEPTxAddr(ENDP5, ENDP5_TXADDR);
SetEPTxStatus(ENDP5, EP_TX_NAK);
SetEPRxStatus(ENDP5, EP_RX_DIS);
/* Initialize Endpoint 5 */
SetEPType(ENDP5, EP_BULK);
SetEPRxAddr(ENDP5, ENDP5_RXADDR);
SetEPRxCount(ENDP5, 32);
SetEPRxStatus(ENDP5, EP_RX_VALID);
SetEPTxStatus(ENDP5, EP_TX_DIS);
_SetEPRxStatus(ENDP5, EP_RX_VALID);
_SetEPTxStatus(ENDP5, EP_TX_VALID); |
|