HardFault in USB_WritePacket()


I’m receiving data with UART-DMA, then my callback sends the data to a mailbox, then a task check the mailbox, get the mail and send data by USB with CDC_Transmit_FS().

The problem is that after working for 3-5 minutes, it crashes with a hardfault(PRECISERR) at USB_WritePacket() in the macro USBx_DFIFO. I don’t think I’m sending a bad index with UART-DMA because I always send the same data and size. Also, when I comment the function CDC_Transmit_FS() it doesn’t crash so I think it’s a USB driver problem but I can realize the problem. Any idea?

Thank you!

Is it the same issue as this one - HardFault after receiver task read some mails

Have you tried the things that I suggested there?