2020-09-17 12:39 AM
In my project i am print my log using printf function and in syscalls.c file i am print my printf log using CDC_Transmit_FS function.
__attribute__((weak)) int _write(int file, char *ptr, int len) {
CDC_Transmit_FS((uint8_t*) ptr, len);
return len;
}
after a sending some bunches of data CDC_Transmit_FS function return me USBD_BUSY error and not print data on my serial terminal.
Thanks and Regards
swapnil
2020-09-18 10:00 PM
Using something like this can run into issues if you're calling printf within an interrupt. CDC_Transmit_FS is unlikely to be re-entrant or thread safe, ensure you're only calling it from a single source, or disable interrupts around the call. Record the return value to ensure the function is successful.
2020-09-25 10:10 PM
Hello TDK,
thanks for replay, but In my case my all external interrupts are already set on priority level 1. and usb interrupt is set to 0 which is by default
and the problem is sometimes i didn't get interrupt from USB so my hcdc->TxState = 0 not set to 1.