# Communication between Arduino GIGA R1 WiFi and ODrive Pro via CAN bus

**URL:** <https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648>\
**Category:** Support\
**Created:** [February 11, 2025, 4:46pm UTC](https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648 "2025-02-11T16:46:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dlmed](https://discourse.odriverobotics.com/user_avatar/discourse.odriverobotics.com/dlmed/32/6600_2.png) [@dlmed](https://discourse.odriverobotics.com/u/dlmed)\
**Post date:** [February 11, 2025, 4:46pm UTC](https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648/1 "2025-02-11T16:46:19Z")

</div>

Hi, I’m trying to make work the communication between an Arduino GIGA R1 WiFi and an ODrive Pro via CAN bus. I already made the communication work with an Arduino UNO R4 WiFi, but for limitations of this board on a specific application I need to switch to an Arduino GIGA R1 WiFi. When I tried the same setup but just switching the board, the GIGA crashed. I tried modifying the `can_helpers.hpp` file by changing the "`tempBuf`"s into “`(uint8_t*) (&tempVal)`”, which made the board stop crashing, but still not working properly.

After some debugging, I can confirm that the GIGA receives properly the messages **from** the ODrive (feedback), but it is not capable to send properly **to** the ODrive (setState(), setVelocity(), etc). How can I find the problem and potentially fix it?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![solomondg](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@solomondg](https://discourse.odriverobotics.com/u/solomondg)\
**Post date:** [February 21, 2025, 3:10am UTC](https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648/2 "2025-02-21T03:10:49Z")

</div>

Hi! Apologies for the delay in my reply here.

Do you have a USB-CAN adapter, by any chance? It would be good to be able to monitor the bus that way, see if the GIGA is sending malformed messages or failing to send messages at all. You could maybe add a print statement in `sendMsg` to see if can\_intf.write is returning non-zero.

---

<div class="post-metadata">

**Author:** ![dlmed](https://discourse.odriverobotics.com/user_avatar/discourse.odriverobotics.com/dlmed/32/6600_2.png) [@dlmed](https://discourse.odriverobotics.com/u/dlmed)\
**Post date:** [February 26, 2025, 10:04am UTC](https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648/3 "2025-02-26T10:04:10Z")

</div>

Hi, yes, I did some debugging with a CAN/USB adapter and at the end it was not forming the right messages (data = 00 00 00 00 00 00 00 00). At the end it got fixed changing can\_helpers.hpp, I think the issue was between the union and using tempBuffer or tempVal:  
In the can\_get\_signal\_raw if using tempBuff the GIGA crashes, but works using tempVal:

```auto
memcpy((uint8_t*) (&tempVal), buf, N);
//memcpy(tempBuf, buf, N);

```

In the can\_set\_signal\_raw if using tempVal the raw data is not written properly (because it gets deleted when buf gets coppied into tempVal). It works with tempBuf:

```auto
//memcpy((uint8_t*) (&tempVal), buf, N);
memcpy(tempBuf, buf, N);

```

With these modifications it works fine with the GIGA. Anyways I saw the library got updated some weeks ago, and with that version of can\_helpers.hpp (without unions) also works fine, so I will be using that from now on.

---

<div class="post-metadata">

**Author:** ![solomondg](https://discourse.odriverobotics.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@solomondg](https://discourse.odriverobotics.com/u/solomondg)\
**Post date:** [February 26, 2025, 2:51pm UTC](https://discourse.odriverobotics.com/t/communication-between-arduino-giga-r1-wifi-and-odrive-pro-via-can-bus/12648/4 "2025-02-26T14:51:59Z")

</div>

Ah great to hear the new library works as well! Apologies for the issues.
