iBUSTelemetry.h compile error for STM32


I have a Flysky RX that can transmit telemetry to my Flysky TX, thru IBUS. I want to use it with STM32 bluepill, as I use the bluepill for all of my projects. However, I get compillation error. This error is not there, when compile to f.ex Mega2560.

Q: How can I get this to compile? :slight_smile:

Error message:

C:\Users\alfa\Documents\Arduino\libraries\iBUSTelemetry-Arduino-master\iBUSTelemetry.cpp:22:30: fatal error: util/delay_basic.h: No such file or directory

#include <util/delay_basic.h>


compilation terminated.

exit status 1
Error compiling for board Generic STM32F103C series.

This is the example code for iBUSTelemetry.h:

#include <iBUSTelemetry.h>


iBUSTelemetry telemetry(11); // I use only PCINT0 interrupt vector, so you can use D8 to D13 pins.

uint32_t prevMillis = 0; // Necessary to updateValues() method. Look below.
float i = 0;

void setup()
    telemetry.begin(); // Let's start having fun!

    telemetry.addSensor(0x01); // You can use sensors definitions from iBUSSensors.h instead of numbers.
                               // Ex.: telemetry.addSensor(IBUS_MEAS_TYPE_TEM);


void loop()
    updateValues(); // Very important! iBUS protocol is very sensitive to timings.
                    // DO NOT USE ANY delay()! Look at updateValues() method.
                    // It's an example of how to use intervals without delays.

    telemetry.run(); //It must be here. Period.

void updateValues()
    uint32_t currMillis = millis();

    if (currMillis - prevMillis >= UPDATE_INTERVAL) { // Code in the middle of these brackets will be performed every 500ms.
        prevMillis = currMillis;

        telemetry.setSensorValueFP(1, i); // Now, you have two ways to set sensors values. Using floating point variables
                                          // or directly in 32bit integer, but then you have to format variable by yourself.
                                          // Ex.: telemetry.setSensorValueFP(1, 24.45); is equivalent to telemetry.setSensorValue(1, 2445);
                                          // The values differ for different sensors.

        telemetry.setSensorValue(2, telemetry.gpsStateValues(3, 8)); // As GPS status consists of two values,
                                                                     // use gpsStateValues(firstVal, secondVal) to set it properly.

        telemetry.setSensorValue(3, 123 * 10);

        telemetry.setSensorValue(4, 179583647); // You can set LAT / LON using FP metohod, but due to fact floats have only 6 digits precision,
                                                // your values on tx may be corrupted in some cases. It's better to use setSensorValue().

        telemetry.setSensorValue(5, UNARMED); // ARMED / UNARMED or 1 / 0 could be used.

        telemetry.setSensorValue(6, LOITER); // Available flight modes:	   STAB   0
																		// ACRO   1
																		// AHOLD  2
																		// AUTO   3
																		// GUIDED 4
																		// LOITER 5
																		// RTL    6
																		// CIRCLE 7
																		// PHOLD  8
																		// LAND   9

        telemetry.setSensorValueFP(7, 54.87);

        i += 0.1;
        if (i > 50)
            i = 0;

        // These were the most difficult sensors to use. I hope that this library will be useful for you and will make your work easier. :)
} /* updateValues */

Please follow the advice given in the link below when posting code. Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

Please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that "iBUSTelemetry-Arduino" library from.

Or just drag the URL into a post from the browser


Updated with link to library :slight_smile:

This file is part of avr-libc, which is include with the toolchain for the AVR architecture of the Mega, Uno, etc. As you discovered, the STM32 toolchain does not have this file. This means the library author has written the library in a way that is not portable to the STM32 architecture. I think the only way you would be able to use this library is by changing its code. I'm not sure how difficult that would end up being. You might first look around to see if any alternatives are available.

1 Like

Thank you for your valued input. I will try to find alternatives or use a different board. Change the code at that level is above me.

I'm interested too ...
Someone solved the problem ... but it's a secret ... I found a .hex for STM32 ..with telemetry .....
Presentation ...GPS навигатор на твой карповый кораблик - YouTube
Archive ... GPS.rar - Google Drive

@Tordens It's my library which I wrote a few years ago for my own hexa drone. I totally forgot about it! This lib was written strictly for AVR (in my case Arduino Pro Micro) and needs to be adjusted for ESP32. If you have any questions, write me an email -> a.slomian@outlook.com.
Best regards, guys!

If they are interested in this library on esp32, let me know. I'll find some time :slight_smile:


@ adis1313
I join those who thank you for what you have done and for the time you give us..Hello!
Any mistakes ... Google Translate ...

Hello adis1313 and thank you for your time and effort.

If you could build a library that make us complile for the stm32 bluepill for arduino, it would be great! The mega is limited and big in size. My quadcopter use Joop brokkings famous code and the stm32 bluepill is cheap, fast and reliable :slight_smile: So it would be a benefit send ibus data to my TX on ground (as a safety, I know where my drone is regardless of other systems onboard).

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.