Infinite Sending of Information Through UART

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
1 Solution
Anonymous
Not applicable

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:

HandleBleProcessing->

case CYBLE_STATE_CONNECTED:

else if(CyBle_GattGetBusStatus() != CYBLE_STACK_STATE_BUSY)

            {

                HandleUartTxTraffic();

            }

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.

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

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:

HandleBleProcessing->

case CYBLE_STATE_CONNECTED:

else if(CyBle_GattGetBusStatus() != CYBLE_STACK_STATE_BUSY)

            {

                HandleUartTxTraffic();

            }

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.

0 Likes