Solved
USB CDC and FreeRTOS
Hi
in different posts in forum I read ST's USB library is not thread safe. There are no examples with USB CDC and FreeRTOS.
Is that true?
Thx
Hi
in different posts in forum I read ST's USB library is not thread safe. There are no examples with USB CDC and FreeRTOS.
Is that true?
Thx
Hi
ST USB middleware is not explicitly using malloc() and free(), but it is crucial to configure it to use static memory allocation to ensure thread safety.
/**
* @brief Static single allocation.
* @param size: Size of allocated memory
* @retval None
*/
void *USBD_static_malloc(uint32_t size)
{
static uint32_t mem[(sizeof(USBD_CDC_HandleTypeDef)/4)+1];/* On 32-bit boundary */
return mem;
}
/**
* @brief Dummy memory free
* @param p: Pointer to allocated memory address
* @retval None
*/
void USBD_static_free(void *p)
{
}
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.