Associate II
July 30, 2019
Question
Why does the STM32F407 send a STALL on USB_FS?
- July 30, 2019
- 19 replies
- 5001 views
Hi,
I'm using STM32F407 and try to establish a USB communication. Until now the device is present in the system and is also able to send and receive bulk transfers. To test the functionality I wrote a simple example:
if MCU receives a string of 5 characters it responds with 60 characters.
The response:
dieptsiz1.d32 = USB.INEP_REGS[1]->DIEPTSIZ;
dieptsiz1.b.xfrsiz = 60;
dieptsiz1.b.pktcnt = 1;
USB.INEP_REGS[1]->DIEPTSIZ = dieptsiz1.d32;
USB.INEP_REGS[1]->DIEPCTL |= DIEPCTLx_EPENA|DIEPCTLx_CNAK;
for (uint32_t i = 0; i < 15; i++){
*(USB).DFIFO[1]=USB_buffer[i];
}If transfer is complete I set
USB.INEP_REGS[1]->DIEPCTL |= DIEPCTLx_SNAK;
in IN(1) Transfer completed interrupt to prevent firing ITTXFE (IN token received when TxFIFO is empty) which is activated.
This is working 5 to 10 times but suddenly the MCU does not respond normally. Instead of sending the next 60 characters it responses with status 0xc0000004 - STALL_PID.

Why does the MCU send a STALL?
