- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
if(uartTxDataLength >= (mtuSize - 3))
Why do we control .What is the purpose here? I did not see any information about it.
Uart_to_ble.app
if((0 != uartTxDataLength) && (NOTIFICATON_ENABLED == txDataClientConfigDesc))
{
if(uartTxDataLength >= (mtuSize - 3))
{
uartIdleCount = UART_IDLE_TIMEOUT;
uartTxDataLength = mtuSize - 3;
}
else
{
if(--uartIdleCount == 0)
{
/*uartTxDataLength remains unchanged */;
}
else
{
uartTxDataLength = 0;
}
}
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Basically the implementation is to send Data from UART RX over the BLE only when the UART RX receives considerable data (greater thanb MTU-3). It breaks such large data into packets of MTU-3 and sends it as individual notifications.
If the UART RX data is short (less than MTU-3), the code will wait UART_IDLE_TIMEOUT (1000 runs) for more data to arrive. Even after 1000 runs, if the UART RX does not exceed MTU-3, it will just go ahead and send whatever be the short packet it has. Till the 1000 runs is reached, it will keep looking for more data. In every run if more data has not arrived, it will just set uartTxDataLength as 0, so that no data is sent.
If you do not want a timeout kind of implementation, please set UART_IDLE_TIMEOUT as (1) in app_uart.h
Regards,
- Madhu Sudhan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In addition
if(--uartIdleCount == 0)
{
/*uartTxDataLength remains unchanged */;
}
I want to do with a different structure.I do not want to use Timeout. How can I do it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I would assume the mtu size check is to make sure all of the data is sent in the same packet?
And rewriting the code to not use a timeout should be easy enough, but not using timeouts allows the unit to lockup the uart if it doesn't work properly for sending valid data, correct format, too much data, too long between data, etc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Basically the implementation is to send Data from UART RX over the BLE only when the UART RX receives considerable data (greater thanb MTU-3). It breaks such large data into packets of MTU-3 and sends it as individual notifications.
If the UART RX data is short (less than MTU-3), the code will wait UART_IDLE_TIMEOUT (1000 runs) for more data to arrive. Even after 1000 runs, if the UART RX does not exceed MTU-3, it will just go ahead and send whatever be the short packet it has. Till the 1000 runs is reached, it will keep looking for more data. In every run if more data has not arrived, it will just set uartTxDataLength as 0, so that no data is sent.
If you do not want a timeout kind of implementation, please set UART_IDLE_TIMEOUT as (1) in app_uart.h
Regards,
- Madhu Sudhan