Hi forum… I am working with esp32 and platformio using freertos OS.
I have already worked with queues but now I am getting a crash of the system calling
this
if (xQueueReceive(report_queue_from_uart_to_wifi,(void *) &report_struct_receive, 0) == pdPASS)
Here all the code…
Definition of the struct
typedef struct report_t
{
uint16_t machine_id;
uint16_t report_id;
tm init_time;
tm end_time;
uint16_t duration;
} report_t;
where tm is defined in file time.h in the folowing way …
struct tm
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
#ifdef __TM_GMTOFF
long __TM_GMTOFF;
#endif
#ifdef __TM_ZONE
const char *__TM_ZONE;
#endif
};
Creation of the struct variable
report_t report_struct;
UBaseType_t queue_lenght = 10; /*optimal value to be defined*/
Creation of the queue
/**
* @brief Function to create the queue for exchanging data between Wifi and uart task
* @param None
* @retval None
*/
void Create_queue_for_exchange_reports_between_uart_and_wifi(void)
{
report_queue_from_uart_to_wifi = xQueueCreate(queue_lenght, sizeof(report_t));
}
/**
Sending the struct to the queue it is crashing the fw too
if (xQueueSend(report_queue_from_uart_to_wifi, (void *)&report_struct, 0) == pdPASS)
{
/*to do cleaning the structure*/
}
The problem is also in receiving.
if (xQueueReceive(report_queue_from_uart_to_wifi, (void *)&report_struct_receive, 0) == pdPASS)
{
where the struct is defined in this way
report_t report_struct_receive;
What is wrong ?
Thanks a lot for your help