# Control Myxa with UART

**URL:** <https://forum.zubax.com/t/control-myxa-with-uart/1731>\
**Category:** Electric drives\
**Created:** [February 3, 2021, 2:45am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731 "2021-02-03T02:45:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [February 3, 2021, 2:45am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/1 "2021-02-03T02:45:56Z")

</div>

Hi,  
I’m trying to control the Myxa with an Arduino over serial. Is there a document somewhere that explains how to format the serial packets and what parameters can be read/written? I couldn’t find what I needed in the knowledge base.

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [February 3, 2021, 10:48am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/2 "2021-02-03T10:48:59Z")

</div>

Currently, the best we can offer is this:

> [@Short coding example for serial interrogation of Myxa](https://forum.zubax.com/t/short-coding-example-for-serial-interrogation-of-myxa/1413):
>
> Hi, we are integrating the Myxa in a “proof-of-concept-board” as we speak. I’d like to keep integration efforts low - at least until we know that everything works. So we’ll be using RCPWM to control the ESC and serial/UART interrogation to read out current, voltage, RPM, and possibly fault states. We took a short look at the popcop documentation and figured that this requires some reading and some learning curve. So I was looking for an easier solution for reaching the “proof-of-concept”. So t…

but we are working on supporting UAVCAN v1 in Myxa, which will be available not only as UAVCAN/CAN but also as UAVCAN/serial via UART and USB.

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [February 5, 2021, 9:10am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/3 "2021-02-05T09:10:06Z")

</div>

Hi Pavel,  
I was able to control the motor and get telemetry over UART by copying the parsers in messages.py in Kucher. However, I can’t find the part where we find part at the very beginning when you get the hardware/firmware version after connecting. Can you point me to the right location to find the correct packet structure?

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [February 5, 2021, 3:33pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/4 "2021-02-05T15:33:21Z")

</div>

It’s here:

> <https://github.com/Zubax/popcop/blob/master/python/popcop/standard/endpoint_info.py>

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [February 5, 2021, 7:17pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/5 "2021-02-05T19:17:08Z")

</div>

Is there a table somewhere to look up the “frame type code”?

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [February 5, 2021, 7:26pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/6 "2021-02-05T19:26:12Z")

</div>

For standard messages there is only one frame type code:

[https://github.com/Zubax/popcop/blob/f45deea2486fa1d5f18d575c7eba7197bbd22e32/python/popcop/\_\_init\_\_.py#L33](https://github.com/Zubax/popcop/blob/f45deea2486fa1d5f18d575c7eba7197bbd22e32/python/popcop/_%5C_init__.py#L33)

For application-specific:

> <https://github.com/Zubax/kucher/blob/fced36646d693fbdd6baa30cbcafaae11ef45cdd/kucher/model/device_model/communicator/messages.py#L459-L464>

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [February 6, 2021, 6:16pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/7 "2021-02-06T18:16:22Z")

</div>

Thanks, I got it working.

If anyone else needs to control Myxa with an Arduino over UART, I uploaded my code here:

> **[GitHub - mah115/Zubax-Myxa-uart-codec-avr: Zubax Myxa motor controller UART...](https://github.com/mah115/Zubax-Myxa-uart-codec-avr)**
>
> Zubax Myxa motor controller UART codec exemplary implementation for AVR usecase - GitHub - mah115/Zubax-Myxa-uart-codec-avr: Zubax Myxa motor controller UART codec exemplary implementation for AVR ...

My MCU was the Teensy4.0.

---

<div class="post-metadata">

**Author:** ![dan](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/eada6e/32.png) [@dan](https://forum.zubax.com/u/dan)\
**Post date:** [March 21, 2022, 4:49pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/8 "2022-03-21T16:49:01Z")

</div>

Hi Mah, would you kindly be able to share your python script to control and monitor myxa?

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [March 21, 2022, 10:54pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/9 "2022-03-21T22:54:32Z")

</div>

sorry, I never made a python script. the code in the git repo linked is all I have.

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 20, 2022, 11:19am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/10 "2022-07-20T11:19:20Z")

</div>

Hi, mah

Do you use UART using a pin of dronecode probe?  
I am using dronecode probe’s 2(Rx) and 3(Tx). problem is your code could not parse the messsage through the pin but I think the message from USB connection is no problem…

AM I something wrong?

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [July 20, 2022, 3:33pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/11 "2022-07-20T15:33:27Z")

</div>

Check the serial port settings, they should be 115200 8N1.

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 21, 2022, 1:39pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/12 "2022-07-21T13:39:22Z")

</div>

Thanks, Pavel

My board is not teensy 4.0 used by man but it is lolin nodemcu v3 esp8266.

I think I should change something to work in my board, but I don’t know what exactly what I do. I am not professional.

Could you let me know what and how to change?

Thanks,

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [July 21, 2022, 2:48pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/13 "2022-07-21T14:48:23Z")

</div>

I can’t help with “how” but the “what” is to set the baud rate to 115200, 8 bit word, no parity, one stop bit.

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 22, 2022, 12:50pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/14 "2022-07-22T12:50:54Z")

</div>

Thanks, I order teensy 4.0.

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [July 22, 2022, 7:47pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/15 "2022-07-22T19:47:04Z")

</div>

Hi Denny,  
I don’t use the dronecode probe, the debug port is connected directly to the microcontroller. Make sure the settings are like Pavel said and that Rx\<-\>Tx for both lines. Also, when you make an instance of the object you need to indicate the serial ports you want to use. In the example code I was using Serial3 and Serial5 for command/logging, so you need to edit this to make it correspond with the serial port on your device.  
For the NodeMCU V3, I think you cna try using Serial0 (GPIO1/3) and Serial2 (GPIO13/15).

 ![image](https://forum.zubax.com/uploads/default/original/1X/dd0bb9f0df0399246f622c71c4f0c673c766096f.jpeg)

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 23, 2022, 10:43am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/16 "2022-07-23T10:43:12Z")

</div>

Hi mah,

Thanks for your reply.

NodeMCU V3 doesn’t have 2 hardware serial(googling, somebody said it does not have 2 serial). So, I changed to ESP32 NodeMCU.

Before I posted here, I could check serial monitor something broken.

So, I have checked the setting and find some weird. why is the result in serial monitor different?

Firmware : 0.4

Below code is just modified.

```
MyxaESC myxa(&Serial2, 115200, &Serial, 115200,MYXA_STATUS_CMD_HOLDUP_MS,MYXA_RUN_TASK_HOLDUP_MS);

```

1. NodeMCU + Myxa(microUSB connect)  

2. NodeMCU + Myxa(DC-Power/14v)  

3. NodeMCU + Myxa(DC-Power/14v) + BLDC motor(not running) :

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 24, 2022, 2:56pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/17 "2022-07-24T14:56:18Z")

</div>

is there way to downgrad the firmware from 4.0 to 3.0??

---

<div class="post-metadata">

**Author:** ![pavel-kirienko](https://forum.zubax.com/user_avatar/forum.zubax.com/pavel-kirienko/32/180_2.png) [@pavel-kirienko](https://forum.zubax.com/u/pavel-kirienko)\
**Post date:** [July 24, 2022, 3:31pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/18 "2022-07-24T15:31:49Z")

</div>

Yes. Older firmware revisions are still available upon mere request, but we no longer distribute them publicly. Your request is unusual, however, because normally, there should be no reason to downgrade. Could you please clarify what you are trying to achieve? If you require any older firmware version, please either PM me or send a message to [support@zubax.com](mailto:support@zubax.com).

---

<div class="post-metadata">

**Author:** ![mah](https://forum.zubax.com/user_avatar/forum.zubax.com/mah/32/891_2.png) [@mah](https://forum.zubax.com/u/mah)\
**Post date:** [July 25, 2022, 6:46am UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/19 "2022-07-25T06:46:35Z")

</div>

Can you post some photos of your setup?

---

<div class="post-metadata">

**Author:** ![denny](https://forum.zubax.com/letter_avatar_proxy/v4/letter/d/9de053/32.png) [@denny](https://forum.zubax.com/u/denny)\
**Post date:** [July 25, 2022, 12:20pm UTC](https://forum.zubax.com/t/control-myxa-with-uart/1731/20 "2022-07-25T12:20:51Z")

</div>

For firmware 4.0, something changed.  
I check the byte order comparing to kajuwise’s code.

byte controlModeBytes[4] = {myxaUnescapedMsg[97], myxaUnescapedMsg[98], myxaUnescapedMsg[99], myxaUnescapedMsg[100]};

above line should be chaged like this.

byte controlModeBytes[4] = {myxaUnescapedMsg[101], myxaUnescapedMsg[102], myxaUnescapedMsg[103], myxaUnescapedMsg[104]};

mah : your code is difficult to me. So I couldn’t modify. However, very thannks!!!

[Next page](https://forum.zubax.com/t/control-myxa-with-uart/1731.md?page=2)
