2019-03-21 10:55 AM
The main loop of the HID_Standalone example is:
while(1)
{
USBH_Process(&USBHost);
HID_MenuProcess();
}
The problem is when a slow process is put in the loop:
while(1)
{
HAL_Delay(10); //or any slow process > 8ms
USBH_Process(&USBHost);
HID_MenuProcess();
}
In this case the USB host stop receiving keyboard characters.
Just one occurrence of a process or delay with more than 8 ms in the loop causes permanent failure in the process of receiving characters typed from the keyboard.
How keep the delay and USBHost working?
2019-04-03 05:30 AM
@note Care must be taken when using HAL_Delay(), this function provides accurate delay (in milliseconds)
based on variable incremented in SysTick ISR. This implies that if HAL_Delay() is called from
a peripheral ISR process, then the SysTick interrupt must have higher priority (numerically lower)
than the peripheral interrupt. Otherwise the caller ISR process will be blocked.
To change the SysTick interrupt priority you have to use HAL_NVIC_SetPriority() function.
information of this applicaiton.