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
Finden Sie den richtigen Händler für unsere Module, Komponenten und Endprodukte in Ihrer Region!
Der EnOcean-Newsletter informiert Sie regelmäßig über spannende Projekte aus den Bereichen IoT und Smart Building sowie über aktuelle Veranstaltungen und neue Produkte.
© 2024 EnOcean GmbH. Alle Rechte vorbehalten.