Dear Friends,
I am working on implementing Bulk data transfer between C5515USB Stick and PC. I did not use CSL library nor CSL_postTransaction functions. I simply went through usb.c example in t TI directory. Using the code below, I managed to read 64 bytes of data coming from PC. But, I could not send any data to PC. I don't think that the problem is about endpoint or configuration descriptors. What is the problem in my firmware code? Any help will be appreciated. Thanks..
Regards...
Yusuf
//////////////////////////////
/ Initialize Bulk EP1 //
USB_INDEX_TESTMODE = 1; // Select Index 1 USB_RXFIFOADDR = 8; // Select offset 8 USB_TX_RXFIFOSZ = ((fifosize | ((double_buffer & 1)<<4)) << 8) | (fifosize | ((double_buffer & 1)<<4)); // Buffer size USB_TXFIFOADDR = 8 + (1<<(fifosize+double_buffer)); USB_RXMAXP_EP1 = FIFO_MAXP; // FIFO maximum packet size (value set in the begenning of this file) USB_TXMAXP_EP1 = FIFO_MAXP; USB_PERI_TXCSR_EP1 = 0x2000; //Configure PERI_TXCSR Register for ;Bulk In Transactions USB_PERI_TXCSR_EP1 |= 0x0010; // Flush FIFO USB_PERI_RXCSR_EP1 = 0x0000; USB_PERI_RXCSR_EP1 |= 0x0010; // Flush FIFO
////////////////////////////// //EP1 interrupt service ////////////////////////////// //EP1 sending a data package to host if (ep1_tx == 0x0002) { fifo_write_ep1(pBuffer16_ep1,64); USB_PERI_TXCSR_EP1 |= 0x01; //Set TXPKTRDY (B0 of PERI_TXCSR) } //EP1 receiving a data package from host
if (ep1_rx == 0x0200) { fifo_read_ep1(pBuffer16_ep1_read, 32); USB_PERI_TXCSR_EP1 &= 0xFE; printBuffer (pBuffer16_ep1_read, 32); }
void fifo_write_ep1(Uint16 *buf, int size){ int i; USBSCR |= 2; //enable byte access by CPU and LOW-byte is selected
for (i=0; i<size; i++) { USB_FIFO1R1 = *buf; buf++; } USBSCR &= ~0x03; //enable word access by CPU}void fifo_read_ep1(Uint16 *buf, int size){ int i; USBSCR |= 2; //enable byte access by CPU and LOW-byte is selected
for (i=0; i<size; i++) { *buf = USB_FIFO1R1 ; buf++; } USBSCR &= ~0x03; //enable word access by CPU}
I am using USBlyzer USB analyzer software in order to trace the transactions between host and device. According to the output, firmware sends STALL packet when IN transaction request has came.The endpoint should send data in response to IN token packets instead of stalling. Indeed, there is not any stall routine for EP1 in my code as seen above code. Thanks in advance for any help..
Best...