Continuous sending problem

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

cross mob
Anonymous
Not applicable

Hi,

   

I'm approaching to the PSoC4 after using PSoC1 and PSoC5LP, I started with some examples, and now I'm using the sample code "Day020_BLE_UART", where there is a Central device and a Peripheral one.

   

My problem is that unless I send a single packet everything is ok, but when I want to send a greater packet (more than 250 byte) I have some problem, to by-pass the problem, I thought to split my packet in many packets and send them, but happen something strange, ex. when I send 11 packets it's all ok, but when I send more than 11 packets I receive only the first four packets.

   

Debugging seems that after the fourth packet the program doesn't go in the AppCallBack function.

   

I tried putting delays but it doesn't work.
My central unit is a CY8C4247LQI-BL483
peripheral unit is a CY8C4248LQI-BL583

   

With sincere thanks for your time
best regards 

   

Antonio

0 Likes
1 Solution
Anonymous
Not applicable

I changed the sending part into the do while, before write, I check the bus status if is equal to CYBLE_STACK_STATE_FREE, so I receive 11 packets instead of 4 packets, but the other ones after the 11th don't arrive... now, I am not sure that the problem is the peripheral, maybe the problem is on the central unit. I tried to send only one character more times, and I received 11 times that character, so the problem isn't the buffer size, seems that more than 11 times I can't send continuosly a payload.

   

After, I tried to put the processEvents before the write and the check, and put some delay. If I use this in the main, it finally works, but I use it in a library, so now, I try to change something to make it work.

View solution in original post

0 Likes
3 Replies
rola_264706
Level 8
Level 8
50 likes received 25 likes received 10 likes received

Please post your code so we can check it,

0 Likes
Anonymous
Not applicable

In the central unit I use this code for test:               

   

                    for(k=0;k<15;k++)
                    {
                        uartTxDataWriteCmd.value.len  = (uint32)20;
                        uartTxDataWriteCmd.attrHandle = rxCharHandle;
                        uartTxDataWriteCmd.value.val  = "12345678901234567890";break;
                        do
                        {
                            bleApiResult = CyBle_GattcWriteWithoutResponse(cyBle_connHandle, &uartTxDataWriteCmd);
                            CyBle_ProcessEvents();
                        }
                        while((CYBLE_ERROR_OK != bleApiResult) && (CYBLE_STATE_CONNECTED == cyBle_state));
                        //CyDelay(10);
                    }

   

I just receive the first 4 packets, but if I use for(k=0;k<11;k++) he sent all the 11 packets...this is what I don't understand.

   

I try to put delays but it's the same, anyway, I think that the central send all the packets and the problem is the peripheral that don't receive them.

   

           case CYBLE_EVT_GATTS_WRITE_CMD_REQ:
                 // receive data and put it in the UART
                 HandleUartRxTraffic((CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventParam);

   

                  break;

   

This is the block in the AppCallBack that receive the packets, with the debug I saw that when I use more than 11 packets, the program go into this part for the first 4 packets, then return on the HandleBleProcessing, instead, when I use ex 10 packet, the program go into this part 10 times, one for packet.

   

In the main polling loop (of the peripheral) there is only this two line:

   

while(1)

   

{

   

        //*******************************************************************
        //*  Process all pending BLE events in the stack
        //*******************************************************************
        HandleBleProcessing();
        CyBle_ProcessEvents();

   

}

   

Hope it is useful for catch the problem.

   

Thanks

   

b.r.

0 Likes
Anonymous
Not applicable

I changed the sending part into the do while, before write, I check the bus status if is equal to CYBLE_STACK_STATE_FREE, so I receive 11 packets instead of 4 packets, but the other ones after the 11th don't arrive... now, I am not sure that the problem is the peripheral, maybe the problem is on the central unit. I tried to send only one character more times, and I received 11 times that character, so the problem isn't the buffer size, seems that more than 11 times I can't send continuosly a payload.

   

After, I tried to put the processEvents before the write and the check, and put some delay. If I use this in the main, it finally works, but I use it in a library, so now, I try to change something to make it work.

0 Likes