Okay. It was not too hard.
Here is main.c which is demonstrating the problem in my environment:
/*
* main.c
*
* Created on: Aug 15, 2025
* Author: nikolaypo
*/
#define DebugUART_PRIO 5
#define TASK1_TASK_PRIO 4
#define TASK2_TASK_PRIO 3
#define TASK1_STK_SIZE 256
#define TASK2_STK_SIZE 256
#define DebugUART_STK_SIZE 256 //Stack size for debug background output handler
//#define DebugUARTtxSize 320 //Size of debug UART Tx buffer
//#define xBufferSizeBytes DebugUARTtxSize
#include "FreeRTOS.h"
#include "task.h"
#include "stream_buffer.h"
#include "message_buffer.h"
//Static tasks memory
TaskHandle_t xDebugUART; //Debug background output handler for RTOS tasks
StaticTask_t xDebugUART_TCB; //Task data structure
StackType_t puxDbgUARTstkBuf[DebugUART_STK_SIZE]; //Static task stack buffer
TaskHandle_t Task1Task_Handler;
StaticTask_t xTask1Buffer;
StackType_t uxTask1StackBuffer[TASK1_STK_SIZE];
TaskHandle_t Task2Task_Handler;
StaticTask_t xTask2Buffer;
StackType_t uxTask2StackBuffer[TASK2_STK_SIZE];
//FreeRTOS debug messages static stream buffer
uint8_t pucDbgMsgBufStor[320/*xBufferSizeBytes*/]; //Debug message buffer storage area
StaticMessageBuffer_t xDbgMsgBufStruct; //Debug message buffer structure
StreamBufferHandle_t xDebugMsgStream; //Debug message buffer handler
//UART message buffer receiver task stuff
static const char HelloString[] = "\nUART started\n"; //Printed each time the UART is configured or re-configured
void task1_task(void *pvParameters) {
(void) pvParameters;
TickType_t xLastWakeTime;
xLastWakeTime = xTaskGetTickCount();
while (1) {
vTaskDelayUntil(&xLastWakeTime, 60);
xStreamBufferSend(xDebugMsgStream, "tsk1\n", 5, 0);
}
}
void task2_task(void *pvParameters) {
(void) pvParameters;
TickType_t xLastWakeTime;
xLastWakeTime = xTaskGetTickCount();
while (1) {
vTaskDelayUntil(&xLastWakeTime, 61);
xStreamBufferSend(xDebugMsgStream, "tsk2\n", 5, 0);
}
}
void vUART_DMAtx(void *pvParameters) {
(void) pvParameters;
char Buff[320/*xBufferSizeBytes*/];
xStreamBufferSend(xDebugMsgStream, (const void*) HelloString, sizeof(HelloString) - 1, 0); //Send helloString to fill the buffer by first message
for (;;) {
size_t Size = xStreamBufferReceive(xDebugMsgStream, (void*) Buff, sizeof(Buff), portMAX_DELAY); //Wait for next message
if (Size > 0) { //Sanity check for size of data requested for a transmission
//Some data need to be transferred
asm volatile ("NOP");
//I'm getting here only first time after calling xStreamBufferSend() above at first entering to vUART_DMAtx()
} else {
//Size of request is zero or there is no request. Do nothing.
}
} //Repeat forever
}
int main(void) {
//Create background debug stream buffer for sending debug messages to UART
xDebugMsgStream = xStreamBufferCreateStatic(320/*xBufferSizeBytes*/, 1, pucDbgMsgBufStor, &xDbgMsgBufStruct);
/* create tasks */
xDebugUART = xTaskCreateStatic(vUART_DMAtx, (const char*) "DebugUART", DebugUART_STK_SIZE, (void*) 1, DebugUART_PRIO, puxDbgUARTstkBuf, &xDebugUART_TCB);
Task1Task_Handler = xTaskCreateStatic((TaskFunction_t) task1_task, (const char*) "task1", (uint16_t) TASK1_STK_SIZE, (void*) NULL,
(UBaseType_t) TASK1_TASK_PRIO, uxTask1StackBuffer, &xTask1Buffer);
Task2Task_Handler = xTaskCreateStatic((TaskFunction_t) task2_task, (const char*) "task2", (uint16_t) TASK2_STK_SIZE, (void*) NULL,
(UBaseType_t) TASK2_TASK_PRIO, uxTask2StackBuffer, &xTask2Buffer);
/* Start the RTOS scheduler. */
vTaskStartScheduler();
for (;;) {
asm volatile ("NOP");
//Shouldn't run at here
}
}
UPD: archived file is attached.
StreamBufferNotifyFailureTest.zip (1.4 KB)