Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.7.31][C][U2D2][XH540-W270-R] Issue : Baudrate 4.5M does not work #430

Closed
robotiscustomer opened this issue Aug 5, 2020 · 8 comments
Closed

Comments

@robotiscustomer
Copy link

ISSUE TEMPLATE ver. 1.1.1

BE CAREFUL!! FOLLOW THE RULES AS FOLLOWS, OR YOUR ISSUE WILL BE WON'T FIX ANYWAY

STEP 1. Check what you are suffering from :

  • I'm using DynamixelSDK ver. 3.7.31

  • I'm using C Language

  • I'm using U2D2 serial converter

  • I'm using XH540W270-R

  • and I'm having an issue

I am trying to modify the sample program in DynamixelSDK/c/example/protocol2.0/read_write to suit my project.

I set the Baudrate of a XH540-W270R via the Linux version of DynamixelWizard 2.0 to 4.5M. After modifying the include parameters for XH540-W270R, I set the Baudrate to 4500000. However, when I run the program, I got:

Succeeded to open the port!
[PortHandlerLinuxLLsetCustomBaudrate] Cannot set speed to 4500000, closest is 4800000
Failed to change the baudrate!
Press any key to terminate...

Both U2D2 and XH540-W270 eManual mentioned that 4.5M rather than 4.8M is supported. I have also set the latency of the USB0 port to 1 ms.

STEP 2. Write Title as [3.7.31][C][U2D2][XH540-W270-R] Issue : Baudrate 4.5M does not work

  • Now, if you think :

    • Hey, I'm using RoboPlus2.0, and having an issue, but how can I write that kind of Title?

    • Hey, I'm using USB2AX serial converter, and having an issue, but how can I write that kind of Title?

    • or more that is not listed on above.

  • , You should write your issue on http://en.robotis.com/BlueAD/board.php?bbs_id=old_qna

STEP 3. Delete all written here, and describe what your problem is

After changing the Baudrate and the included parameters to match those for XH540-W270-R, I got the following error when I executed: ./read_write under ~/Desktop/DynamixelSDK/c/example/protocol2.0/read_write/linux64

Succeeded to open the port!
[PortHandlerLinuxLLsetCustomBaudrate] Cannot set speed to 4500000, closest is 4800000
Failed to change the baudrate!
Press any key to terminate...

Here is the part in the read_write.c program that I changed:

// Control table address
#define ADDR_PRO_TORQUE_ENABLE 64 // Control table address is different in Dynamixel model
#define ADDR_PRO_GOAL_POSITION 116
#define ADDR_PRO_PRESENT_POSITION 132

// Protocol version
#define PROTOCOL_VERSION 2.0 // See which protocol version is used in the Dynamixel

// Default setting
#define DXL_ID 1 // Dynamixel ID: 1
#define BAUDRATE 4500000
#define DEVICENAME "/dev/ttyUSB0" // Check which port is being used on your controller
// ex) Windows: "COM1" Linux: "/dev/ttyUSB0" Mac: "/dev/tty.usbserial-*"

#define TORQUE_ENABLE 1 // Value for enabling the torque
#define TORQUE_DISABLE 0 // Value for disabling the torque
#define DXL_MINIMUM_POSITION_VALUE 0 // Dynamixel will rotate between this value
#define DXL_MAXIMUM_POSITION_VALUE 4095 // and this value (note that the Dynamixel would not move when the position value is out of movable range. Check e-manual about the range of the Dynamixel you use.)
#define DXL_MOVING_STATUS_THRESHOLD 10 // Dynamixel moving status threshold

#define ESC_ASCII_VALUE 0x1b

@ROBOTIS-Will
Copy link
Contributor

Hi,
Regarding the 4.5Mbps, there was an issue with not getting a closer baudrate.
The hotfix has been applied on the develop branch, so please use the develop branch code or download the develop branch zip file from the link below.
https://github.com/ROBOTIS-GIT/DynamixelSDK/archive/develop.zip
Thank you.

@robotiscustomer
Copy link
Author

Hi Will, thank you. In the U2D2 eManual, under Baudrate, it states that at 4.5M, the actual BPS is 4571,428.571 with an error of 1.56 but in the XH540-W270R eManual, it states that 4.5M is supported. So, does this fix reduce the error % when using the XH540-W270R with U2D2 under Linux?

@ROBOTIS-Will
Copy link
Contributor

Hi,
The baudrate of each device is dependent on the hardware(MCU) they use.
Since the margin of error for 4.5Mbps between DYNAMIXEL and U2D2 is less than 3%, there's no problem running DYNAMIXEL with U2D2 at 4.5Mbps.
Thank you.

@robotiscustomer
Copy link
Author

Thanks. In the worst case, what could happen? Will the DYNAMIXEL gone crazy, move unexpectedly and damage themselves due to moving out of the expected range of motion and collide with other body parts?

@ROBOTIS-zerom
Copy link
Member

If baudrate error exceeds 3%, communication fails.
It's like trying to communicate with devices set with different baudrate.

@robotiscustomer
Copy link
Author

Thanks.

Since the margin is less than 3%, am I correct that I don't need to worry about this will be happening?

@ROBOTIS-zerom
Copy link
Member

https://www.ftdichip.com/Support/Knowledgebase/index.html?an232b_05calc.htm

The exact Baud rate may not be achievable - however as long as the actual Baud rate used is within +/-3% of the required Baud rate then the link should function without errors.

@robotiscustomer
Copy link
Author

Thanks

smkaeser added a commit to WeRobotics/DynamixelSDK that referenced this issue Jan 14, 2021
* Non-standard baudrates are supported on the latest Mac OS

* - added clear instruction & example

* fixed bug removeStuffing

* - added clear instruction

* added clear_multi_turn example

* remove python build

* - reduced TXPACKET_MAX_LEN & RXPACKET_MAX_LEN (4K -> 1K)
  because the size of most Dynamixel receive buffers is 1K.
- checked whether memory allocation was successful.
- marked the crc table as static const
- changed addStuffing() function (reduced stack memory usage)
- removed busy waiting for rxPacket()
- fixed the broadcastping bug in dxl_monitor

* - modified "ros" directory C++ code.

* added clearmultiturn packet handler

* added ros clearMultiTurn API

* modified ros clear multi turn

* sync opencjr

* sync opencm

* add macro

* updated the CHANGELOG and version to release binary packages

* Update bulk_read_write.py

fixed typo.

* - updated c lib & dll file.

* fixed typo.

* - fixed "protocol_combined" example bug

* - changed C# / win32 / protocol_combined output path.

* Updated the CHANGELOG and version to release binary packages

Signed-off-by: Pyo <pyo@robotis.com>

* Updated the CHANGELOG and version to release binary packages

Signed-off-by: Pyo <pyo@robotis.com>

* Update README.md

* - fixed buffer overflow bug (rxpacket size)

* Fixed buffer overflow bug (rxpacket size)

Signed-off-by: Pyo <pyo@robotis.com>

* Added change log information

Signed-off-by: Pyo <pyo@robotis.com>

* Fixed typo in the package.xml and header files

Signed-off-by: Pyo <pyo@robotis.com>

* Added imports to __init__.py in ros package.

* - packet timeout in broadcastPing() overflow bug fixed.
- bug in python removeStuffing() fixed.

* - fixed "conflicting types for 'reboot'" error in mac OS.

* Fix two potential memory leaks. (ROBOTIS-GIT#361)
- Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>

* - fixed memory leak issue (group sync/bulk series)

* - fixed an issue loading the wrong library (in x86)

* 3x faster getError member function of GroupSync&BulkRead Class ROBOTIS-GIT#388

* Update setup.py

changed the version of Dynamixel SDK

* support noetic

* update version info

* resolve package name conflict

* revise ROS1 version

* DynamixelSDK_ros_examples

* update comment

* Update CMakeLists.txt

* - modified setCustomBaudrate() function. (ROBOTIS-GIT#430)

* update changelog

* update issue template

* update issue template

* Update read_write.py

- position length bug fixed.

Co-authored-by: kizitorashiro <kizitora.shiro@gmail.com>
Co-authored-by: Pyo <pyo@robotis.com>
Co-authored-by: zerom <zerom@robotis.com>
Co-authored-by: kijonggil <kkjong@robotis.com>
Co-authored-by: Darby Lim <thlim@robotis.com>
Co-authored-by: guichristmann <guichristmann@gmail.com>
Co-authored-by: Will Son <willson@robotis.com>
Co-authored-by: Ryan Jaehyun Shim <38637417+rjshim@users.noreply.github.com>
masf7g added a commit to quasi-robotics/DynamixelSDK that referenced this issue Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants