# Receiving File Read Responses

**URL:** <https://forum.opencyphal.org/t/receiving-file-read-responses/2232>\
**Category:** Applications & Usage\
**Created:** [December 2, 2024, 6:25pm UTC](https://forum.opencyphal.org/t/receiving-file-read-responses/2232 "2024-12-02T18:25:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mighty\_mick](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mighty\_mick](https://forum.opencyphal.org/u/mighty_mick)\
**Post date:** [December 2, 2024, 6:25pm UTC](https://forum.opencyphal.org/t/receiving-file-read-responses/2232/1 "2024-12-02T18:25:56Z")

</div>

Hello,

I have an application which runs on STM32 Bare Metal Target. It is a node device and it sends UAVCAN messages and receives them.

My device already works, but it is lack of something: firmware update. I am trying to add firmware update via uavcan to my device. I’ve already received the File.read responses, but there is one problem. My program’s begin firmware update handler looks like below:

 ![image](https://forum.opencyphal.org/uploads/default/original/2X/1/1949c4b56b77e5c12a3b3cd986581ba21215355d.png)

This is my handler function to handle begin firmware update request. It works well. When i receive the request, i can respond to it. The problem starts here:

As you know, the program which does these kind of things simply have a loop. That loop does receiving, spinning and publishing stuff. When i write my code like this, i am able handle receive File.Read responses with my handler function **handleFileReadResponse**. The code is given below.

 ![image](https://forum.opencyphal.org/uploads/default/original/2X/9/91329421b96a14cfea33617c0dddf1b8b2e571f1.png)

As you see, i am sending my read file requests in firmware update handler, and it jus works. I am receiving the Read.File responses correctly. But i do not wanna stop the main loop, so i wanna update a flag when request is the received and control it in every loop iteration. I wanna design something like this:

 ![image](https://forum.opencyphal.org/uploads/default/original/2X/c/c23bfbea0953759b0a65568f895e8b890b565433.png)

This is the main loop which i am planning to control firmware update process.

 ![image](https://forum.opencyphal.org/uploads/default/original/2X/a/a8b5f8c09133eec3373084c5dc45c3f36874359f.png)

This loop just does not work! I mean, i send read file requests correctly, i montior them by Drone\_CAN, but i just can not receive the responses.

I didn’t understand the underlying reason. When i send my requests inside Begin firmware update request handler, i am receiving File.read responses. But when i send them outside of this function, it just doesn’t work.

I could misunderstood the flow logic of uavcan program or library etc. I wanna be informed about this, could you please give me useful resources or recommendations about my situation?

Thank you.

---

<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:** [December 2, 2024, 6:48pm UTC](https://forum.opencyphal.org/t/receiving-file-read-responses/2232/2 "2024-12-02T18:48:21Z")

</div>

This is a general programming question that is not related to DroneCAN/Cyphal.

---

<div class="post-metadata">

**Author:** ![mighty\_mick](https://forum.opencyphal.org/letter_avatar_proxy/v4/letter/m/da6949/32.png) [@mighty\_mick](https://forum.opencyphal.org/u/mighty_mick)\
**Post date:** [December 2, 2024, 6:56pm UTC](https://forum.opencyphal.org/t/receiving-file-read-responses/2232/3 "2024-12-02T18:56:46Z")

</div>

Where should i ask 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:** [December 3, 2024, 10:27am UTC](https://forum.opencyphal.org/t/receiving-file-read-responses/2232/4 "2024-12-03T10:27:34Z")

</div>

An LLM like ChatGPT should be able to help with this better than any human mentor.
