Active monitor implementation on STM32

I want to use example “Active monitor” from chapter “Node discovery” of libuavcan tutorial ( on my MCU STM32F103.

I add code from example and my project was builded successful. In debugging mode I check starting of retriever and adding listener and has no errors.

But monitoring is not work - collector.getNodeInfo(i) return nullptr for correct node id.
My mcu connected to pixhawk and i see can bus traffic by means of usb oscilloscope and I not see GetNodeInfo request.

May be someone know what is it?

Let’s have a look at your code.

I create uavcan_node.cpp (is attached) for working with uavcan in my project. In this file I use class NodeMonitor from example. In main function I call


and in while infinite loop I call


uavcan_node.cpp (13.9 KB)

The instance of NodeInfoRetriever is destroyed when the initialization function exits. You have to ensure proper object lifetimes:

Thank You, Pavel! You absolutely right!