2 Replies Latest reply on Nov 23, 2015 12:51 PM by jacac_663366

    Newbie Question - BLE Serial Communication

      I am using your example code UART_to_BLE_central and UART_To_BLE_peripheral to test serial communication between two devices CY8C4248LQI-BL483 (Peripheral) and the PRoc Dongle (Central).  I am trying to find the best insertion point for our code.  Data will be transmitted from the central device to the peripheral.   Instead of being transmitted out through the UART on the peripheral device, we will be collecting the data to be sent out to a display instead.  So on the Peripheral side, the serial transmission touches HandleUartRxTraffic in app_UART.c which points to UART_SpiUartPutArray in the UART_SPI_UART.c file.  This in turn touches UART_SpiUartWriteTxData in the same file.  


      What I am noticing is when I put a breakpoint on any one of these routines and start typing data in from the Central device via Tera Term, I will break multiple times on the same routine for a single character typed.  I can set conditional break points to ensure I am getting all the characters which I transmitted ( in this case, at least I know how many characters to receive);  However, I am not certain how to handle this in my code.   So the questions are, why am I invoking the same function over and over again for a single piece of data, and how can I get around this so I know each piece of data sent is unique?  


      Clearly this is doable since the receive terminal does not duplicate characters, though it's a mystery at this point why it does not.

        • 1. Re: Newbie Question - BLE Serial Communication



          Are you putting breakpoint at the line:


          if(uartRxDataWrReq->handleValPair.attrHandle == CYBLE_SERVER_UART_SERVER_UART_RX_DATA_CHAR_HANDLE)


          in app_UART.c file of the peripheral project, and finding that for one byte sent from central, multiple times this line is serviced?

          • 2. Re: Newbie Question - BLE Serial Communication

            My Problem was that I did not understand how tera term functions, one byte at a time.  I was thinking that typing a series of characters into the window would result in those characters being stored in a fifo, irrespective of the breakpoint occurring, so that all characters could ultimately be accessed.  But this is not the case.  The breakpoint stalled the transmission of subsequent bytes of data,  so I went instead to a terminal program called Cool Term which allows you to transmit an entire string at once, and I was able to access all bytes that were transmitted.