RE: Half Duplex UART for TTL Commincation and Wiring w/ the HC126 and HC04

@ROBOTIS-Will,

I will make a schematic soon of what I have done to see if this schematic is of any use for this particular AX-12A.

Seth

P.S. Sir, is the Direction_PORT on the sample.png schematic a GPIO pin on my board?

Hello Sir,

I compiled the SDK on my linux host SBC. The python3 scripts work but I am receiving an error.

python3 read_write.py
Succeeded to open the port
Succeeded to change the baudrate
[TxRxResult] There is no status packet!

What is the status packet?

Seth

@Kurt,

Sir, is the Direction_Port a GPIO or PWM pin? I can use either but I am unaware of what Direction_Port means.

Seth

P.S. I have the communication down pat but the Direction_Port is the missing link so far on my end. The AX-12A turns on for a bit but then the LED fades out. I tried 9v and 12v. I am getting close. Anyway, I will produce a schematic when it is all done and completed.

Hi,

The DIRECTION_PORT should be connected to a GPIO pin so that it can control the Input / Output direction of data from the buffers.
[TxRxResult] There is no status packet! error means that your program failed to receive the status packet from DYNAMIXEL.
Please refer eManual for more information about the status packet.
You should set up a correct direction control in order to communicate with DYNAMIXEL.

If you are using an SBC with available USB port, you could simply use U2D2 + U2D2 PHB to control DYNAMIXEL.

Thank you.

Hello,

Okay. No issue. Thank you.

Seth

Hello,

@ROBOTIS-Will

I finally got connected via the Wizard. I am not sure how to use it just yet but I will find the manual and figure it out.

Seth

P.S. Does the Wizard work with 64-bit machines or does it only work with 32-bit machines?

@silver2row
Glad that you figured out the connection and successful communication.
DYNAMIXEL Wizard 2.0 supports 3 major OS so please refer to the eManual below.
https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_wizard2/
If you are using 32bit Windows, the software should work on your machine.

@ROBOTIS-Will,

Sir…w/ the SDK, can I run ping.py as python3 ping.py and receive feedback via the console or should I type up my own source from your SDK?

Seth

P.S. I installed dynamixel_helper via pip and I am trying it now. I have failed so far but I think I need to alter the source of the DynamixelSDK to suit my needs.

Hi,

The codes in the tests directory is written to be run under Linux.
I’d recommend to check if a correct data is transmitted from the port on the control board before getting the response from DYNAMIXEL.

ping.py will work as is if you are running Protocol 2.0 DYNAMIXEL with the factory default setting on Linux.
Below products will work with ping.py example on Linux :

  • XL430-W250-T
  • All XM/XH430 series
  • All XM/XH540 series

Hello Sir,

@ROBOTIS-Will the UART channel and GPIO onboard my SBC works. I have tested it. I need to use Protocol 1 b/c I have an AX-12A only. I have two of them.

Should ping.py work under Linux with Protocol 1?

Seth

Seth,

My bad, let me rephrase my last comment.
The test codes under the Protocol2_0 directory is written for Protocol 2, and you can use test codes under Protocol1_0 for your AX-12A.
If you haven’t change any setting on AX-12A, the code should work on your Linux without any change.
If you are using an embedded controller, this python code may not work as the port defined by DEVICENAME will work differently.
For more accurate information, please describe your development environment with more details such as SBC product name, OS, version, which port name your UART is assigned at, and etc.
Thank you.

Hello Sir,

Okay. No issue. I understand that I was not giving the entire view. So…

I am using a BBB (BeagleBone Black), Linux Debian 10, kernel 4.19.x, and DEVICENAME is equal to “/dev/ttyS2”.

"/dev/ttyS2" is my UART Ports onboard the BBB.

I have been running through the DynamixelSDK to change some things under silver2row on Github.com. This way, when I clone it, I can then use sudo python3 setup.py install to get things working properly.

I know I do not know a bunch about you all’s SDK so far.

Seth

P.S. My GPIO pin is P9.12 and I have it setup as GPIO. I can add a library in the source to make it so I can control the GPIO with code.

Thank you for additional information.
It looks like you haven’t modified the writePort function in the port_handler.py which will control your GPIO pin for direction control.
If you take a look at the writePort function in port_handler_arduino.cpp, you’ll see setTxEnable() and setTxDisable(). These functions control the GPIO pin of the Arduino related boards in their HAL layer. You should do the same for your python code in order to make your code work correctly when sending or receiving data.
Thank you.

@ROBOTIS-Will,

Hello. Okay, you rule. I will test this later. I was not even aware of this .cpp file called port_handler_arduino.cpp and I must have gotten mixed up in the Python source thinking that I could do everything w/ Python. Oops.

Again, and I repeat, you rule!

Seth

My pleasure!
Please let me know how it works as your case can be an important reference for other users as well.
I’m considering creating a tutorial for a similar case like this.

Hello,

Yes sir…I will test it soon so I can reply with my findings.

Seth

Hello @ROBOTIS-Will,

Why would my RX timeout and create the issue of, [TxRxResult] There is no status packet!, no status packet when my wiring seems to be correct?

I know there are a lot of differences in my circuit and the U2D2 circuit. I will purchase the U2D2 soon but I would still like to be able to compile the entire library on my Linux_SBC.

I mean…

Could my RX timeout be happening b/c of no compiled examples or could my RX timeout be b/c of my 3.3v logic from my UART connection? I can use a dc-dc converter or logic level shifter w/ ease. This is not a concern. When you have time, please try to make me understand. I can use all the help one man can get. Peace!

Okay. I was reading some more and found that compilation gives me errors under the ld prefix like so:

 /usr/bin/ld: cannot find -ldxl_sbc_c

I compiled this file correctly (dxl_sbc_c). Should I have compiled it later or before the compilation of the other C/C++ examples?

Anyway, ping.c and the other examples do not compile in C or C++ even when the .so file is created. I cannot use make to compile those files. Are there any hints or ideas spanning around for this endeavor?

@silver2row - sorry I know I am not much help with this one.

A long time ago (about 7 years ago) I did play around some with the BeagleBone Black. Needles to say probably things have changed a lot since then, but back then you had to jump through hoops to enable GPIO. I don’t remember the details any more. At some point I believe you had to do something with device trees.

Again I don’t remember if any regular GPIO pins are already setup…

But that would be one of the first things I would check. And of course if it were me, I would have one of my logic analyzers setup to watch the TX, RX and Direction pin, to see if your setup is properly setting the direction to TX mode at the proper time and then switching to RX mode and to see if anything comes in on the RX pin.

And Note I would also have a 4th pin hooked up on my LA to the actual Dynamixel BUS to make sure things like what I TX actually makes it out.

Again I know that is not much help.

Hello @Kurt,

Seth here. No issue at all. I am most likely going to purchase the U2D2 and power supply to test things out (most likely).

If that does not get my motors up and running, I think I need to look deeper into the source and rearrange some items dedicated to my particular setup.

The GPIO enablement on the boards these days, for the BBB, is as easy as config-pin p9.12 gpio.

There is a “new” config-pin utility to set up modes of peripherals onboard the chip. For instance, there are many modes on one, single pin. So, say Pin 12 on P9 or p9_12 (same thing), I use a pin for UART, I can then change the pin to GPIO w/ the config-pin utility in userspace.

Seth

Hi Seth (@silver2row )

Sounds like they probably improved the BeagleBone since I played with it. I played with it for awhile and then moved on to Odroid, Edison, UP, … Then back now playing a little with RPI4. But mostly not doing anything right now with their servos.

I also don’t have one of their U2D2 which may be a perfect solution for you.

I have typically preferred to solve it using an external processor chip like the U2D2, but have done it several different ways, not sure if any of the other ways would meet your needs or not.

a) Most of the time when wanted quick and dirty and compact I would use the USB2AX by Xevel Labs - Not sure if available any more.

b) make my own USB2AX - It is an Atmega32u2… So you can use an Atmega32U4 board, which includes Leonardo, Teensy 2 and I believe others that you can get from Amazon, Mouser, digikey

b1) any other AVR based Arduino that has both USB and a Serial port that you can use at the same time.

With these you can make them safer, but or you can simply connect the RX and TX pins of the uart together and to the DXL pin of a AX like plug, and likewise common ground.

Simple to write sketch that when it receives data from the host, it enables TX and disable RX on the serial port and sends the data and when all data is sent, it disables the TX and re-enables the RX and when it receives any data on the RX it simply sends them off back to the USB…
There are usually a few other things to put in like if nothing received again on RX for a certain amount of time to do a flush on the USB port to get the data through. Or can enhance code more to know about packets and when it sees an end of packet send it then…

c) Like above but instead I use a Teensy 3.x or 4.x can do all like b)
But note: T3x outputs 3.3 v not 5v. Never had problems with servos seeing 3.3v signals. Also only some of the T3.x are 5v tolerant (T3.2, 3.5) so if you use one of these I often do direct.
Can either work like the AVR or can configure for half duplex mode and simply connect the TX pin of the UART to DXL… Note with my newer boards I put in other hardware to convert to 5v signals…

More on code and stuff if interested.

d) Just use an OpenCM9.04 board - They are made for this and cheap. Could either buy one without connectors and buy their connector


Or you can buy their one with connectors on it, which they are out of stock at least at the US store. And if you buy it with connectors than you need to adapt from XL320 connectors to AX. Can do this their more expensive and bulky way, of use their openCM 485 expansion board which also has AX servos on it.

Or at one point I made my own HUB that had one XL320 servo connector on it and I think 6 of the AX servo connectors on it plus connector to hook up power. A slightly modified version of the Trossen Robotics DXL hub.

Or what started off doing, take an XL320 cable and an AX cable, but them both in half and splice one XL connector part to an AX connector part.

Again software for this is really simple. I believe you can simply use their default firmware that comes with the OpenCM board…

It used to be with the Robotis tools, they allowed the OpenCM 9 boards to do things like upgrade servo firmware, but some more recent versions of PC software it was not enabled anymore (at least the last time I looked).

Again the U2D2 is a very good choice, but thought I would mention some of the other options.