WICED 3.1.X bug -- queues fail to work when in '-debug' mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
cogoc_1937206
Level 4
Level 4
First like received

Hello,

I've encountered what appears to be a bug in the WICED framework:  Calls to wiced_rtos_init_queue() always fail (return WICED_WWD_QUEUE_ERROR) when the application has been built with the '-debug' option, and when using ThreadX.  I've confirmed that this is the case even for the snip.scan application running on the BCM943362WCD4 dev kit with the following minor code modifications:

static void createQueueTest()

{

    wiced_result_t res;

    wiced_queue_t dummyQueue;

    res = wiced_rtos_init_queue(&dummyQueue, NULL, 700, 2);

    printf("DummyQueue init %s! (%d)\r\n", (res == WICED_SUCCESS ? "succeeded" : "failed"), (int)res);

    res = wiced_rtos_deinit_queue(&dummyQueue);

    printf("DummyQueue de-init %s! (%d)\r\n", (res == WICED_SUCCESS ? "succeeded" : "failed"), (int)res);

}

void application_start( )

{

    wiced_init( );

    createQueueTest();

    while(1)

Note that I'm running WICED 3.1.1.  I have also confirmed that this issue does not exist when using FreeRTOS.

Please confirm whether you are able to reproduce this issue.

Thanks!

0 Likes
1 Solution
SeyhanA_31
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi,

For ThreadX, the max message_size (* @param message_size : size in bytes of objects that will be held in the queue) for the wiced_rtos_init_queue(...) is 64. Basically message_size/4 number of messages are held a the queue.

Make the following change:

res = wiced_rtos_init_queue(&dummyQueue, NULL, 700, 2); ->

res = wiced_rtos_init_queue(&dummyQueue, NULL, 16, 2); or res = wiced_rtos_init_queue(&dummyQueue, NULL, 64, 2);


Thanks,

Seyhan

View solution in original post

0 Likes
4 Replies
SeyhanA_31
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hi,

For ThreadX, the max message_size (* @param message_size : size in bytes of objects that will be held in the queue) for the wiced_rtos_init_queue(...) is 64. Basically message_size/4 number of messages are held a the queue.

Make the following change:

res = wiced_rtos_init_queue(&dummyQueue, NULL, 700, 2); ->

res = wiced_rtos_init_queue(&dummyQueue, NULL, 16, 2); or res = wiced_rtos_init_queue(&dummyQueue, NULL, 64, 2);


Thanks,

Seyhan

0 Likes

Thanks, Seyhan!  I've confirmed that this works.  What I'm not entirely sure of, though, is why a message size of 700 works with the regular build target (i.e. no '-debug' option included).  In this case, calls to wiced_rtos_init_queue() return 0 as expected, and the queue seems to function as expected...(?)

Cheers!

0 Likes

Hi,

If DEBUG is enabled, the error checking code before creating queue is enabled as well. The error checking code could be enabled without DEBUG as well by commenting out the TX_DISABLE_ERROR_CHECKING code in .../WICED/RTOS/ThreadX/ver5.6/Cortex_M3_M4/GCC/tx_port.h

#ifndef DEBUG

#define TX_DISABLE_ERROR_CHECKING -> comment this out

#endif /* ifndef DEBUG */

Thanks,
Seyhan

0 Likes

Ah, I was only seeing the error-checking code in the WICED-layer (wiced_rtos.c).  This appears to be always-enabled, and checks that the size is a multiple of 4.  I see that the TX_DISABLE_ERROR_CHECKING affects which version of various ThreadX functions the linker is pointed to in the precompiled library.

Thanks!

0 Likes