2025-01-14 09:12 AM
Hi
I am using a STML4xx processor and use HAL for system initialising, and sending strings through the USB port. It works most of the time. I call the below function SendString(...) to send string through the USB port , never within an interupt. I have a volatile variable as a timeout and decremented within the System timer. Sometimes the system sticks inside the CDC_Transmit_FS command, when stuck the System timer doesnt get called. Seems to stick within the routine.
I cant see whay it doesnt break the loop , if it cant send the string. Anyone any idea?
Best Regards
Scott
extern volatile short int USBTimeout;
void SendString(char *Data)
{
int Length=strlen(Data);
USBTimeout=500;
while(CDC_Transmit_FS(Data,Length)==USBD_BUSY && USBTimeout)
;
}
void SysTick_Handler(void)
{
if(USBTimeout)
USBTimeout--;
}