Hello @APede.1
The issue is related to the thread stack size.
In the tx_Thread_Sync example, the thread stack size is set to 512B
The thread creation call uses the define APP_STACK_SIZE
Also, the stack is allocated in the byte pool provided as argument of App_ThreadX_Init function.
So, byte pool size needs to be increased accordingly.
To do this, you open the ioc file to get CubeMX interface, go to middlewares/ThreadX and ThreadX Tab. Memory configuration Topic: change ThreadX memory pool size to say 10*1024 to give room for further allocations and re-generated code with CTRL-S or ALT-K
Then in App_ThreadX_Init:
Replace APP_STACK_SIZE by APP_STACK_SIZE*4
if (tx_byte_allocate(byte_pool, (VOID **) &pointer, APP_STACK_SIZE*4, TX_NO_WAIT) != TX_SUCCESS)
And same for thread create:
if (tx_thread_create(&ThreadOne, "Thread One", ThreadOne_Entry, 0, pointer, APP_STACK_SIZE*4, THREAD_ONE_PRIO,
THREAD_ONE_PREEMPTION_THRESHOLD, DEFAULT_TIME_SLICE, TX_AUTO_START) != TX_SUCCESS)
After executing in debug mode you can open the Window/Showview/ThreadX/ThreaXThreadList
In the ThreadX Thread List window, you will need to click on the top left icon with the 3 horizontal lines.
This will activate the Stack Usage column of this view.
On my side I could see a stack usage of 676 bytes when adding this sprintf.
So, you could have increased size to only APP_STACK_SIZE*2 but when you are not sure it is always better to have margin.
Best regards
Jocelyn