2013-06-04 11:05 PM
Hello,
I am using the latest version of the STM32 USB library on the STM3240G eval board. I have modified the MSC example with my own configuration. This one is coming from a library we bought and works on a STM32F105. Enumeration is exactly the same as with our preveous products so no problem here. But when I start our application on the pc which sends data to EP2 out the ST responds with a NAK instead on ACK (seen with USB analyzer). No interrupt is called and I can't find where I go wrong. The code of my application is exactly the same as the MSC example, exept that I use EP2 out instead of EP1 out. I have inserted a table inside the ReadPacket routine (see below) and I can observe that the complete enumeration got into the fifo. Everything but the OUT package which is send by my pc application (3 bytes: 0x89, 0x13, 0x00) to endpoint 2 which is answered with a NAK. It looks like the USB core refuses this package, because the SOF's come through. I have investigated on register level that every bit is set on the right place, interrupts are enabled but not called (except SOF). I just can't find out WHY this package is NAK-ed. If anyone can give me a hint or even a ''stupid'' remark.... Thanks! void *USB_OTG_ReadPacket(USB_OTG_CORE_HANDLE *pdev, uint8_t *dest, uint16_t len) { uint32_t i=0; uint32_t count32b = (len + 3) / 4; __IO uint32_t *fifo = pdev->regs.DFIFO[0]; for ( i = 0; i < count32b; i++, dest += 4 ) { *(__packed uint32_t *)dest = USB_OTG_READ_REG32(fifo); /***********/ if((myflag == 1) && (myindex_w != 2048)); { myfifo_dwa[myindex_w] = *(__packed uint32_t *)dest; myindex_w++; } /***********/ } return ((void *)dest); } #stm32-usb2013-06-05 10:14 AM
To receive on the OUT endpoint without NAK, DCD_EP_PrepareRx() should be called after the OUT endpoint is opened by DCD_EP_Open()
Tsuneo2013-06-06 01:45 AM
Thanks but this is done, just like in the example code. I just changed the number of the endpoint from 1 to 2...
Dreeke2014-03-25 07:38 AM
2014-03-25 08:14 AM