|
STM32的USB中断上传数据错误,请高手指点!
[复制链接]
大家好,
我用STM32的USB功能,除端点0外增加了3个端点,1-IN,2-OUT,3-Interrup.
现在3号端点(INTERRUPT)上传的数据总是相同,用仿真器跟踪,发现是从40006000内存地址发出的数据,我的配置如下:
SetEPType(ENDP3, EP_INTERRUPT);
SetEPTxAddr(ENDP3, ENDP3_TXADDR);
SetEPTxCount(ENDP3, 4);
SetEPRxStatus(ENDP3, EP_RX_DIS);
SetEPTxStatus(ENDP3, EP_TX_NAK);
#define BTABLE_ADDRESS (0x00)
/* EP0 */
/* rx/tx buffer base address */
#define ENDP0_RXADDR (0x18)
#define ENDP0_TXADDR (0x58)
/* EP1 */
/* tx buffer base address */
#define ENDP1_TXADDR (0x98)
/* EP2 */
/* Rx buffer base address */
#define ENDP2_RXADDR (0xD8)
/* EP3 */
/* tx buffer base address */
#define ENDP3_TXADDR (0x118)
while(SC_InsertFlag == 0x55)
{
SC_InsertFlag = 0x00;
TempCCIDBuff[0] = 0x50;
TempCCIDBuff[1] = 0X00;
TempCCIDBuff[2] = 0X02;
TempCCIDBuff[3] = 0X03;
RespLength = 4;
CCID_Transfer_Data_Request(TempCCIDBuff, RespLength);
}
void CCID_Transfer_Data_Request(u8* Data_Pointer, u16 Data_Length)
{
UserToPMABufferCopy(Data_Pointer, ENDP3_TXADDR, Data_Length);
SetEPTxCount(ENDP3, Data_Length);
SetEPTxStatus(ENDP3, EP_TX_VALID);
}
现在每次从中断端点上传的数据总是 58 00 1A 00
我用仿真器跟踪发现数据是从40006000发出来的: 58 00 00 00 1a 00 00 00
而缓存区40006230(0X118*2+40006000)的数据是:50 00 00 00 02 03
请高手指点一下,为此我已经折腾一周了,恳求高手指点!!
|
|