AX-18A servomotor half-duplex UART


We might want to use the AX-18A servo and for that half-duplex UART is needed. Is that possible with the CORE2-ROS?
We need to use this AX-12A-servo-library for controlling the servo motor. It uses the Arduino framework for serial communication.

Hello M11,

It is possible to use AX-18A servo with CORE2-ROS board, but it will not be a straightforward task.
CORE2 board has all UARTs full-duplex, to use it in half-duplex mode, it will be necessary to use external circuitry for switching between transmit/receive states.
CORE2 boar logic is 3.3V, while servo is TTL leveled. It will be good if circuit is also switching voltage levels.

Furthermore, it will be necessary to to some modifications in the AX-12A library to port it to hFramework. We have prepared an example idea of how to prepare port:

#define DirPin hSens3.pin1
#define varSerial *(hSens3.serial)

char ch_peek;
bool peek_flag = 0;

char readc() {
    char ch;
    if(peek_flag == 1) {
        peek_flag = 0;
    } else {
        ch = ch_peek;
    return ch;

char peekc() {
    peek_flag = 1;
    return ch_peek;

#define sendData(packet, length)      (varSerial->write(packet, length))        // Write Over Serial
#define flush()                        (varSerial->flushRx())                    // Wait until buffer empty
#define availableData()             (varSerial->available())                // Check Serial Data Available
#define readData()                  (readc())                     // Read Serial Data
#define peekData()                  (peekc())                     // Peek Serial Data
#define beginCom(args)              ()                   // Begin Serial Comunication
#define endCom()                    ()                      // End Serial Comunication

#define switchCom(DirPin,Mode)       (DirPin.write(Mode))                   // Switch to TX/RX Mode
#define setDPin(DirPin,Mode)         (mode==0?(DirPin.setIn()):(mode==1?(DirPin.setOut()):(DirPin.setIn_pu()))) // Select the Switch to TX/RX Mode Pin

#define delayus(args)                 (sys.delay(args))                  // Delay Microseconds


In addition, here is the circuit that is used in CM-5 controller (also made by Dynamixel) for interfacing the Dynamixel AX-18 servos: