Results 1 to 8 of 8

Thread: Baudrate problem

  1. Baudrate problem

    Background: Trying to gather torque readings from Dynamixel RX-64 motors (RS485) using Robotis CM700 controller linked to a laptop running Matlab (RS232).

    Problem: Everything was fine, motors moves and feedback are being capture on the laptop. however during testing, motors suddenly became unresponsive. HOWEVER,motor does response (moves and communicates) to firmware program from the same controller i.e hardware are okay (i hope).

    upon checking my code, i suspect that the baudrate initialization has a problem and it is causing communication failure between the motors and the controller:

    int main(void)
    serial_initialize(57600); //for RS232
    dxl_initialize( 0,DEFAULT_BAUDRATE); //RS485
    default_baudrate has been declare as 1

    int dxl_initialize( int devIndex, int baudnum )
                    printf("baudnum %d \n",baudnum);
                    float baudrate; 
                    baudrate = 2000000.0f / (float)(baudnum + 1);
                    printf("baud rate %d \n",baudrate);
                    if( dxl_hal_open(devIndex, baudrate) == 0 )
                                    return 0;
                    gbCommStatus = COMM_RXSUCCESS;
                    giBusUsing = 0;
                    return 1;
    the two printfs here reveals that baudnum=1 (correct) but the baudrate=9216 (which is supposed to be 1000000). even if i replace this line with a baudrate=1000000, it will still come out as baudrate=9216 on the printf and im not sure why.

    I'm using:
    avr-gcc (WinAVR 20100110) 4.3.3

    I hope i did not miss out anything.
    Thanks in advance!

  2. #2

    Re: Baudrate problem

    printf("baud rate %f \n",baudrate);

    Since baudrate is a float.

  3. Re: Baudrate problem

    the controller is not able to print floating point values =/
    i'm currently using Roboplus Terminal v1.03 to view the outputs from the controller....

    i've revert back to a code that has been untouched weeks before this problem started and it is also unable to communicate with the motors... seems like only the onboard firmware is capable communicating....

  4. #4
    Join Date
    Sep 2010
    Rep Power

    Re: Baudrate problem

    The 'DEFAULT_BAUDRATE' preprocessor definition is intended for the AX series (default rate is 1Mbps). If you have not already, you will need to change the Baud Rate register of the RX-64's to '1' (1Mbps) from their default of '34' (57600bps). If you do not want to change the register settings of the RX-64's, then replace 'DEFAULT_BAUDRATE' with '34'.

    If the servos respond for some time before failing: 1) check your power supply (can it handle the current and voltage required) and 2) check the cables connecting the servos (the connectors tend to work themselves loose over time, and intermittent shorts/breaks are very annoying/difficult to track down). For #2, just unplug and reconnect all of the connectors. If that does not work, try unplugging different chains of servos and see if there is any combination that seems to work. If it does start working, replace the cable connecting that chain to the bus and test again. Repeat ad nauseum until you have replaced the faulty cable.
    Last edited by tician; 12-14-2011 at 08:41 AM.
    Please pardon the pedantry... and the profanity... and the convoluted speech pattern...
    "You have failed me, Brain!"
    gives free advice only on public threads

  5. Re: Baudrate problem

    @tician: i've unplugged and plugged back everything but still no luck. The current configuration should give me 1Mbps, i've traced it line by line.... but what confuses me is how the :

    printf("baud rate %d \n",baudrate);

    gives me 9216 instead of a 1000000 even if i should do a


    before the printf statement.

    just earlier today i was working only on the matlab side of my project when suddenly i realized i'm no longer getting readings from the controller... how wierd

  6. Re: Baudrate problem

    i doubt it is a hardware problem because the monitor mode in the cm-700 firmware is able to move all the motors as per normal.

  7. #7

    Re: Baudrate problem

    Why don't you sort out how to print a float value of 1000000.0f. 1000000 seems a very big 16 bit integer to me !
    Until you can understand simple embedded C for the avr, and post what other stuff you created. There seems to be little others can do to help.

    This doesn't solve your response problem, but might get your feet back on the ground.

  8. Re: Baudrate problem

    from what i understand is that small microcontroller's libraries usually do not support printing of floats due to its complexities. printing it out as an integer would truncate the decimals, which is not useful now....

    int main(void)
        serial_initialize(57600);                                    //initialize rs232
        dxl_initialize( 0, DEFAULT_BAUDRATE );            // initialize rs485, DEFAULT_BAUDRATE=1
        sei();                                                                // Interrupt Enable  
        for( i=0; i<NUM_ACTUATOR; i++ )                    //initialize motor id array
            id[i] = i+1;                                                   // Set ID for num_actuator number of motors
            GoalPos[i] = 512;                                       //set all motor GoalPos to middle
        /***START MAIN CODE***/
            update_PresentPosLoad();  //read load & position data from all motors
            printf("P,%i,%i,%i,%i\n", PresentLoad[14], PresentLoad[15], PresentLoad[19], PresentLoad[20]); //print values for matlab
        }//end infinite while loop
        return 0;
    }//end int main(void)
    before the errors start occuring, i was toying around only with the printf statement, trying to make a desired data packet for matlab to read.

    heres the function update_PresentPosLoad. DO note that this function works perfectly fine before the incident. No changes were made to them.

    void update_PresentPosLoad(void)
        int i=0, tempPos=0, tempLoad=0;
        for( i=0; i<NUM_ACTUATOR; i++ )
            tempPos = dxl_read_word( (int)id[i], P_PRESENT_POSITION_L );        // Check motors
            tempLoad = dxl_read_word( (int)id[i], P_PRESENT_LOAD_L );                    // Check motors
            PresentPos[i] = tempPos;    
            PresentLoad[i] = tempLoad;                                            // Store in array

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. XV-11 LDS version 2.6 problem
    By jbot in forum Sensors
    Replies: 32
    Last Post: 01-17-2014, 09:00 AM
  2. Question(s) AX-12 connection problem
    By Jaybots in forum DYNAMIXEL & Robot Actuators
    Replies: 2
    Last Post: 03-10-2011, 02:45 PM
  3. CMUcam3 problem..
    By e0ne199 in forum Sensors
    Replies: 2
    Last Post: 12-02-2010, 11:39 PM
  4. I have a problem!
    By DresnerRobotics in forum Rovers
    Replies: 39
    Last Post: 08-28-2008, 12:18 AM
  5. One problem after another!
    By bidi in forum Arbotix, Microcontrollers, Arduino
    Replies: 22
    Last Post: 02-02-2007, 03:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts