Multiple Tasks with UART ISR

My program has 3 tasks with the RTOS set in co-operative mode on an STM32 device. Also I have a UART interrupt callback that handles buffering incoming UART packets. My program works when only one thread is active, but when I include all three threads the program hangs in vPortRaiseBASEPRI trying to set ulNewBASEPRI. My program looks like so, removing any non-RTOS related segments:

// ------------ START CODE -----------------
osThreadId defaultTaskHandle;
osThreadId Task1Handle;
osThreadId Task2Handle;

static void MX_USART1_UART_Init(void);

void StartDefaultTask(void const * argument);
void Task1(void const * argument);
void Task2(void const * argument);

int main(void) {


osThreadDef(defaultTask, StartDefaultTask, osPriorityNormal, 0, 128);
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);

osThreadDef(Task1_1, Task1, osPriorityNormal, 1,512);
Task1Handle = osThreadCreate(osThread(Task1_1), NULL);
Task2Handle = osThreadCreate(osThread(Task2_1),NULL);

HAL_UART_Receive_IT(&huart2,(uint8_t *) Rx_buff2,6);


while(1) {};

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
// does something

void Task1(void const * arguments) {
for(;:wink: {
// does something else
void Task2(void const * arguments) {
for(;:wink: {
// does something else
void StartDefaultTask(void const * argument) {
for (;:wink: {
// does something else

// ------------ END CODE -----------------

I’ve attempted to trace failed assertions, however no filename nor line number where given when the assert_failed function is reached.

Also, I’ve noticed that the program will actually kind of run when the StartDefaultTask main thread creates the other two threads itself instead of creating them in the main function. When I have it set up that way, the UART interrupts work and the main thread works, but the other two tasks never start.

Please let me know what horrible RTOS atrocities I’ve committed with my code.