1 Reply Latest reply on Feb 28, 2018 9:28 AM by epr_1639216

    Infinite Sending of Information Through UART

      Hello, I am trying to send data through UART between two cypress devices and have them engage in 2-way communication based on what they send each other. Currently, I have one cypress sending data to the other one, but it seems to send data infinitely for some reason. I have specifically narrowed it down to the GattcWriteWithoutResponse API call located in App_UART.c. I have attached my project archive, any help would be greatly appreciated.

        • 1. Re: Infinite Sending of Information Through UART

          Change line 113 of app_UART.c to     uartTxDataWriteCmd.value.len  = 20;

          The unit32 cast is unecessary and incorrect, as the uartTxDataWriteCmd.value.len variable is only a single uint16 size.


          Edit: You don't have any control code to keep track of if you have already sent the UART data over BLE and whether you have new UART data to send/receive.

          You are running:



          else if(CyBle_GattGetBusStatus() != CYBLE_STACK_STATE_BUSY)





          Which means that if the previous case statement about notifications being enabled is true, then you will send the UART data every single time the main code loops.

          You should use a flag to indicate if there is new UART data, and to only send if the flag has been set (with BLE RX new data), and clear it after sending the UART data.