# Active monitor implementation on STM32

**URL:** <https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236>\
**Category:** LibCyphal\
**Created:** [November 7, 2018, 4:08pm UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236 "2018-11-07T16:08:26Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pletnev16rus](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/p/a587f6/32.png) [@pletnev16rus](https://forum.opencyphal.org/u/pletnev16rus)\
**Post date:** [November 7, 2018, 4:08pm UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236/1 "2018-11-07T16:08:26Z")

</div>

Hello!  
I want to use example “Active monitor” from chapter “Node discovery” of libuavcan tutorial ([https://uavcan.org/Implementations/Libuavcan/Tutorials/9.\_Node\_discovery/](https://uavcan.org/Implementations/Libuavcan/Tutorials/9._Node_discovery/)) 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?

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [November 7, 2018, 5:40pm UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236/2 "2018-11-07T17:40:04Z")

</div>

Let’s have a look at your code.

---

<div class="post-metadata">

**Author:** ![pletnev16rus](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/p/a587f6/32.png) [@pletnev16rus](https://forum.opencyphal.org/u/pletnev16rus)\
**Post date:** [November 8, 2018, 8:26am UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236/3 "2018-11-08T08:26:59Z")

</div>

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

```auto
uavcan_node::configureNode();

```

and in while infinite loop I call

```auto
uavcan_node::NodeSpin();

```

[uavcan\_node.cpp](https://forum.opencyphal.org/uploads/default/original/1X/0a2d815a95e6be2d22e81e11e79870663632c775.cpp) (13.9 KB)

---

<div class="post-metadata">

**Author:** ![pavel.kirienko](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/pavel.kirienko/32/9_2.png) [@pavel.kirienko](https://forum.opencyphal.org/u/pavel.kirienko)\
**Post date:** [November 8, 2018, 10:15am UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236/4 "2018-11-08T10:15:26Z")

</div>

The instance of `NodeInfoRetriever` is destroyed when the initialization function exits. You have to ensure proper object lifetimes: [https://en.cppreference.com/w/cpp/language/lifetime](https://en.cppreference.com/w/cpp/language/lifetime)

---

<div class="post-metadata">

**Author:** ![pletnev16rus](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/p/a587f6/32.png) [@pletnev16rus](https://forum.opencyphal.org/u/pletnev16rus)\
**Post date:** [November 8, 2018, 10:59am UTC](https://forum.opencyphal.org/t/active-monitor-implementation-on-stm32/236/5 "2018-11-08T10:59:32Z")

</div>

Thank You, Pavel! You absolutely right!
