2025-08-08 12:34 AM
Hello,
I have an issue with this setup:
Nothing is implemented regarding the SPI port yet.
I succesfully went through this STM tutorial: https://www.youtube.com/watch?v=LdY2bieaPwk
Success means: when I switch the PC13 button, the string "Hello World" is transmitted to the terminal on my PC.
Here is the But:
A thread for the blinking of an LED is not running anymore:
VOID LD1_thread_entry(ULONG initial_input){
(VOID)initial_input;
while(1){
HAL_GPIO_TogglePin(LED_RD1_o_GPIO_Port,LED_RD1_o_Pin);
tx_thread_sleep(8); // 1tick per 10ms
}
}
I know the workaround already:
But my understanding is lacking here:
The usbx process is just this:
VOID usbx_cdc_acm_write_thread_entry(ULONG thread_input)
{
UX_PARAMETER_NOT_USED(thread_input);
ULONG actual_length;
while(1)
{
// wait for button press
tx_semaphore_get(&semaphore, TX_WAIT_FOREVER);
// transmit data
ux_device_class_cdc_acm_write(cdc_acm, (UCHAR *)(&Tx_Buffer), (strlen(Tx_Buffer)), &actual_length);
}
}
So all the time while I am not pressing the button, usbx_write_thread is just waiting for the semaphore. By definition is "sleeping" until semaphore wakes the thread up.
But how can this sleeping-process prevent a (low priority) task (LED blinking) from being executed?
The concept of ThreadX is that exactly this should never happen.
I would be grateful if someone knows where "the bug" is.
In case you need more information about the background/code/... just let me know. Right now my code really looks like in the tutorial plus the LED stuff.
Thanks in advance!
Enrico