3 Replies Latest reply on Feb 15, 2017 9:12 AM by ansoc_292866

    Continuous sending problem



      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 



        • 1. Re: Continuous sending problem

          Please post your code so we can check it,

          • 2. Re: Continuous sending problem

            In the central unit I use this code for test:               


                                    uartTxDataWriteCmd.value.len  = (uint32)20;
                                    uartTxDataWriteCmd.attrHandle = rxCharHandle;
                                    uartTxDataWriteCmd.value.val  = "12345678901234567890";break;
                                        bleApiResult = CyBle_GattcWriteWithoutResponse(cyBle_connHandle, &uartTxDataWriteCmd);
                                    while((CYBLE_ERROR_OK != bleApiResult) && (CYBLE_STATE_CONNECTED == cyBle_state));


            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);




            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:






                    //*  Process all pending BLE events in the stack




            Hope it is useful for catch the problem.





            • 3. Re: Continuous sending problem

              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.