cancel
Showing results for 
Search instead for 
Did you mean: 

STM32-H743ZI2 and Dynamixel Servo interaction

MAgui.1
Associate II

Hello, I am looking for some help with operating a Dynamixel  XM540-W270-R servo actuator from a Nucleo-H743ZI2 Development board. I have used CubeMX to initialize all of my peripherals and am using CubeIDE for development. I have 2 basic objectives: 1) be able to write various position 2) be able to read the data off of the servo. I have gone through many of the Robotis references and believe I have constructed the required packets to be sent to the servo correctly over UART but when transmitted and received I get nothing. I am unsure where my error is whether it be physical or software and am very novice to this so please bear with me. Ihave wired a UART Rx and Tx line to the rs485 socket on the dynamixel starter kit. Below is the link to the Dynamixel SDK references that I have been using, I am using C protocol 2 specifically:

https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/overview/

Here are some figures and explanations that may help expand and be a little more specific to what I am doing:

Packet Config

368×635 12.3 KB

Figure 1: This is an example of how I’ve constructed the packets. What’s shown is just the enable and part of the disable torque commands but I also have a status packet, temperature read packet, and goal position packet. I’ve initialized them as int arrays and used the hex format.

Send MSG code

947×640 23.2 KB

Figure 2: this is my procedure and how I am transmitting over the UART lines. I have used an oscilloscope to see that these lines are transmitting and they are but I cannot say definitively that it is correct. Same goes for the actual sequence of events.

USART config

1667×856 79.7 KB

Figure 3: This is CubeMX where I have initialized the tx and rx line with rs485 hardware flow control. If there is anything not in the picture that you need me to expand on I’m happy to do so.

Wiring Setup

1512×2016 241 KB

Figure 4: This is my wiring setup.

PD5 (Brown Wire) UART TX-> pin 4 Starter kit

PD6 (Yellow Wire) UART RX-> pin 3 Starter kit

USB-> Laptop

Dynamixel → RS485 Socket on Starter kit

Please let me know if any of this is not clear or expanded on enough and I’ll get right on it.

Thank you!

3 REPLIES 3
TDK
Guru

If your packet is 16 bytes, you should initialize it as an array of 16 bytes (uint8_t) rather than an array of 16 ints. An "int" is int32_t here. My guess is your transmitted data is 75% zeroes because of this.

>  I have used an oscilloscope to see that these lines are transmitting and they are but I cannot say definitively that it is correct.

Why not? Can you show a screenshot of the first few bytes? Most scopes can decode UART.

Once the TX is correct, then worry about RX. Use a scope to ensure you're ready to receive by the time bytes come in. The delays in your program may hurt you here. Not that since HAL_UART_Transmit is blocking, there is no need to delay between calls unless the thing you're talking to needs time.

If you feel a post has answered your question, please click "Accept as Solution".

I changed the initialization of the array, the packet itself, and my circuit slightly and it allowed me to write a position and move the servo. I was trying to decode my transmitted packet on the oscilloscope but did not have uart functionality. I believe when my company bought the oscilloscope the option for uart decoding was not selected.

MAgui.1
Associate II

Still debugging will update the thread when it is all complete!