This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LP-AM243: Queue.h is not working with FREERTOS

Part Number: LP-AM243

Tool/software:

Hi guys,

I was trying to implement reading and sending queues between 2 tasks in RTOS. My whole program frezzes at Drivers_open() and there are no errors outputed by CCS compiler.
please help and Thank you in advance.

#include <stdlib.h>
#include <kernel/dpl/DebugP.h>
#include "ti_drivers_config.h"
#include "ti_board_config.h"
#include "FreeRTOS.h"
#include "task.h"
#include <stdio.h>
#include "ti_drivers_open_close.h"
#include "ti_board_open_close.h"
#include "queue.h"

#define MAIN_TASK_STACK_SIZE (1024) // Increased stack size
#define TASK2_STACK_SIZE (1024) // Increased stack size
#define QUEUE_SIZE (5)
#define QUEUE_ITEM_SIZE (30)

uint32_t cnt;
TaskHandle_t gMainTask;
TaskHandle_t gTask2;
QueueHandle_t myQueue;

void maintask(void *args) {
char mytxbuff[QUEUE_ITEM_SIZE];
myQueue = xQueueCreate(QUEUE_SIZE, QUEUE_ITEM_SIZE);

if (myQueue == NULL) {
DebugP_log("Failed to create queue\r\n");
vTaskDelete(NULL);
}

sprintf(mytxbuff, "message imp");
xQueueSend(myQueue, (void*) mytxbuff, (TickType_t) 0);
sprintf(mytxbuff, "message 1");
xQueueSend(myQueue, (void*) mytxbuff, (TickType_t) 0);
sprintf(mytxbuff, "message 2");
xQueueSend(myQueue, (void*) mytxbuff, (TickType_t) 0);

while (1) {

}
}

void task2(void *args) {
char myrxbuff[QUEUE_ITEM_SIZE];
while (1) {
if (myQueue != NULL) {
if (xQueueReceive(myQueue, (void*) myrxbuff, (TickType_t) 5) == pdPASS) {
DebugP_log("data received %s \r\n", myrxbuff);
}
}
vTaskDelay(pdMS_TO_TICKS(1000)); // Add delay to prevent tight loop
}
}

int main(void) {
/* init SOC specific modules */
DebugP_log("board initialized start \r\n");
System_init();
DebugP_log("board initialized start2 \r\n");
Board_init();
DebugP_log("board initialized start3 \r\n");
Drivers_open();
DebugP_log("board initialized start4 \r\n");
Board_driversOpen();
DebugP_log("board initialized\r\n");

if (xTaskCreate(maintask, "maintask", MAIN_TASK_STACK_SIZE, NULL, 2, &gMainTask) != pdPASS) {
DebugP_log("Failed to create maintask\r\n");
DebugP_assertNoLog(0);
}
if (xTaskCreate(task2, "task2", TASK2_STACK_SIZE, NULL, 1, &gTask2) != pdPASS) {
DebugP_log("Failed to create task2\r\n");
DebugP_assertNoLog(0);
}

DebugP_log("Tasks created\r\n");
configASSERT(gMainTask != NULL);
configASSERT(gTask2 != NULL);

/* Start the scheduler to start the tasks executing. */
vTaskStartScheduler();

/* The following line should never be reached because vTaskStartScheduler()
will only return if there was not enough FreeRTOS heap memory available to
create the Idle and (if configured) Timer tasks. Heap management, and
techniques for trapping heap exhaustion, are described in the book text. */
DebugP_assertNoLog(0);
Board_driversClose();
Drivers_close();
return 0;
}

output:

board initialized start
board initialized start2
board initialized start3