0

I am really struggling to establish communication between Tiva C TM4C123GH6PM microcontroller to use Dynamixel servo. Here is the circuit where MAX485 converts UART TTL signal to RS485. This servo has a protocol structure for communication. link for that is

http://support.robotis.com/en/product/actuator/dynamixel_pro/communication/instruction_status_packet.htm

The Transmit enable pin i control it using a GPIO pin and TX pin and Rx pin is connected to uC. I am sending out the Data but I do not get any response from the Servo until i terminate the code. for my code I used bit of Dynamixel servo provided SDK and made some changes so it would run on Code composer studio (eliminating Windows API funcs and writing equivalent code).

On the oscilloscope, i have this transmit and receive this but only when i terminate the code and the code just goes into a blocking function (UARTCharGet a blocking function) And never comes back from it as it says that dynamixel did not send any data back and FIFO or (Receive line is just empty)

int writePortArm(int port_num, uint8_t *packet, int length)
{
    //Set to transmit mode
    int iWrite = 0;
    //GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_PIN_4);
    //GLOBAL_SetSysFlag(SYSFLAGS_EOP);

    while(length)
    {
        GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_4,GPIO_PIN_4);
        GLOBAL_SetSysFlag(SYSFLAGS_EOP);

        UARTCharPut(UART0_BASE,(char)*packet);
        *packet++;
        length--;
        iWrite++;
    }

    //Clear the Flag (End of packet)
    // GLOBAL_ClearSysFlag(SYSFLAGS_EOP);

    //Switch to receive mode
    // GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_4,0);

    return iWrite;
}

int readPortArm(int port_num, uint8_t *packet, int length)
{
    int iRead = 0;

    //do the Read
    while(length)
    {
        //uint8_t readX = UARTCharGet(UART0_BASE);
        *packet = (char)UARTCharGet(UART0_BASE);
        *packet++;
        length--;
        iRead++;
    }

    return (int)iRead;
}

i am using Dynamixel SDK https://emanual.robotis.com/docs/en/software/dynamixel/dynamixel_sdk/api_reference/c/c_porthandler/#c-porthandler

I AM converting this base code for supporting Tiva Microcontroller.

enter image description here

enter image description here

  • 1
    This code isn't nearly enough to get a grasp of what you're doing wrong. At least add the initialization routine and the calling functions. In _writePortArm_ you commented out the code to switch back to receive mode. Maybe you forgot to add this in your caller function? – Velvel Feb 04 '22 at 21:35
  • Sorry for being unclear. The issue with providing all code is that it jumps between multiple files and i did not know how i would just express everything here. its my first time using this so apologies. Basically i am using a software-development kit (SDK) provided by Dynamixel Servos which is meant for Windows Platform, whereas i am writing its so called "middleware" for microcontroller platform. basically logic is "clear UART port" .. Send some "Data" and based on received Data.. continue the code. is there any way i can share multiple files here of the code? – Raj Bhatt XP Feb 04 '22 at 21:54
  • GitHub would be a good place to post your code. – Velvel Feb 04 '22 at 22:14

0 Answers0