Search code examples
cstm32freertos

FreeRTOS's StreamBuffer doest start


Freertos StreamBuffer seems like just hangs when I'm creating it with: StreamBufferHandle = xStreamBufferCreate(3,10); IM using stm32h743 mcu with CubeMX generated code in KEIL uvision compiler.

I have made a code that simply checks the creation of the streambuffer

   #include "cmsis_os.h"
    #include "stream_buffer.h"
    static StreamBufferHandle_t StreamBufferHandle = NULL;
    uint8_t data_send[4];

int app_tocheck(void)
{
    // STM32CubeMX initialization code here

    // Create StreamBuffer
    StreamBufferHandle = xStreamBufferCreate(3, 10);

    if (StreamBufferHandle != NULL) {
        // StreamBuffer creation successful
          data_send[0] = 0x5C; // means succesfull
    } else {
        // StreamBuffer creation failed
          data_send[0] = 0xCC; // means failed
        // Handle the error or take appropriate action
    }

    // Code below osKernelStart() should not be executed as the scheduler has started
    while (1) {
        // Handle any non-RTOS tasks or activities here
    }
}

so the data_send[0] stays 0x00, i cant see it int he debugger. If i put data_send[0] before StreamBufferHandle = xStreamBufferCreate(3, 10); - data_send[0] changes to the assigned value. my Freertos heap size is the default #define configTOTAL_HEAP_SIZE ((size_t)15360) what am I missing?


Solution

  • I'm not sure what you are asking as you don't show the code sending to the stream buffer. The posted code shows data_send[0] set to one of two constants, neither of which are zero - so if data_send[0] is zero I would guess the code never runs at all.

    Note your stream buffer has a size of 4 and a trigger level of 10, so the trigger level will never be reached.