This article applies to:
DolphinAPI 2.0.0.0, 2.1.0.0
I am having an application that receives and transmits radio telegrams. When I start the application it works ok, but after a while it stops transmitting telegrams. My source code is the following:
while (1) { CLR_WDT(); // Handle radio to uart traffic if (radio_getTelegram(&rTelIn, &pTelIn) == OK) { io_togDigital(ADIO_5); misc_radioToSerial(&rTelIn,&sTelOut); while (uart_sendTelegram(&sTelOut) != OK); } // Handle uart to radio traffic if (uart_getTelegram(&sTelIn) == OK) { misc_serialToRadio(&sTelIn,&rTelOut); while (radio_sendTelegram(&rTelOut,&pTelOut) !=OK); } }
All Rx and Tx radio buffers shares the same memory resources. Currently there is no radio buffer dedicated to transmitting telegrams. This can lead to a situation that incoming telegrams will fill all available buffers, thus no buffer is left for transmitting a telegram. To avoid this situation you have to keep fetching telegrams from the buffer even when transmitting.
Correct Example:
void FetchTelegram() { // Handle radio to uart traffic if (radio_getTelegram(&rTelIn, &pTelIn) == OK) { io_togDigital(ADIO_5); misc_radioToSerial(&rTelIn,&sTelOut); while (uart_sendTelegram(&sTelOut) != OK); } } while (1) { CLR_WDT(); FetchTelegram(); // Handle uart to radio traffic if (uart_getTelegram(&sTelIn) == OK) { misc_serialToRadio(&sTelIn,&rTelOut); while (radio_sendTelegram(&rTelOut,&pTelOut) !=OK) { FetchTelegram() }; } }
RELATED TO:
4170
FAQ Single Template
Find the right distributor for our modules, components and finished products in your region!
The EnOcean newsletter informs you regularly about exciting projects in the areas of IoT and smart buildings as well as current events and new products.
© 2024 EnOcean GmbH. All rights reserved.