Out of buffers exception

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

cross mob
user_3880456
Level 1
Level 1

Hello,

I want to send data from one PSoC to another every 5 or 10 sec. The model of my kits is PSoC 6 CY8CKIT_062 WiFi-BT Pioneer Kit. I have the following code in my application_start().

    char buff2[10];

    uint16_t light_output;

    float mv2;

    wiced_init( );

    wiced_rtos_init_queue(&paddleQueue,"paddleQueue",sizeof(game_msg_t),10);

    game_msg_t msg;

    wiced_bt_gatt_status_t write_status;

    wiced_adc_init(WICED_ADC_1,5);

    wiced_rtos_pop_from_queue(&paddleQueue,&msg,WICED_WAIT_FOREVER);

    while(1){

        wiced_bt_gatt_value_t *p_write = ( wiced_bt_gatt_value_t* )malloc( sizeof( wiced_bt_gatt_value_t ) + 1 );

        WPRINT_APP_INFO(("Light(mv): "));

        wiced_adc_take_sample(WICED_ADC_1, &light_output);

        mv2 = (light_output*3300)/4096;

        sprintf( buff2,"%f",mv2);

        WPRINT_APP_INFO( ( buff2));

        (p_write)->handle   = 0x002A; /* hard coded server ccd */

        (p_write)->offset   = 0;

        (p_write)->len      = 1;

        (p_write)->auth_req = GATT_AUTH_REQ_NONE;

        (p_write)->value[0] = (uint8_t)(mv2);

        //(&p_write)->value[1] = 0x08;

        write_status = wiced_bt_gatt_send_write ( msg.val, GATT_WRITE_NO_RSP, p_write);

        WPRINT_APP_INFO(( "write_status: %d\n", write_status));

        CyDelay(5000);

        free( p_write );

    }

What this code does is that it waits "msg" to come from another thread. After "msg" comes, it is popped from the queue. Then, every 5 seconds "mv2" is sent to the other kit. However, I can send "mv2" only 7-10 times. After that, the other PSoC crashes (does not receive "mv2" anymore). The PSoC that sends "mv2" also crashes and gives Unhandled bluetooth event 5. The type of this event is wiced_bt_gatt_evt_t, and when I go to declaration of wiced_bt_gatt_evt_t, I can see only 0, 1, 2, 3 and 4 as event values. There is no 5. Also, I get "running low on tx buffers" and "getbuf size is too big" errors. How can I solve this issue?

0 Likes
5 Replies
SheetalJ
Moderator
Moderator
Moderator
First comment on KBA 750 replies posted 500 likes received

Hi alperen.gormez_3880456​,

For a quick answer, please check this related thread and threads in the response. Lets see if this works for you.

Allow me to take sometime to check this issue.

0 Likes

shjl wrote:

For a quick answer, please check this related thread and threads in the response. Lets see if this works for you.

shjl

Which thread? Missing link?

0 Likes
0 Likes
AxLi_1746341
Level 7
Level 7
10 comments on KBA 5 comments on KBA First comment on KBA

alperen.gormez_3880456 wrote:

Also, I get "running low on tx buffers" and "getbuf size is too big" errors. How can I solve this issue?

shjl

It would be helpful if the BT library also shows the requested size with "getbuf size is too big" error.

0 Likes

axel.lin_1746341​,

Unfortunately, we do not have such API as of now.

alperen.gormez_3880456​,

Were you able to solve this problem?

You can have look at following thread: