MDDS30 Reset and Dummy Byte

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

MDDS30 Reset and Dummy Byte

Postby drannex42 » Wed May 05, 2021 6:49 am

Hello!

I am having a minor problem with the MDDS30 in serial packet mode.

I can control everything, and everything works but: Upon start of the MDDS30 I need to need to send a dummy byte (0x80, or 127) as the first byte to initialize autobaud for the device. I know this is required.

The issue is that the dummy byte only works after clicking the reset button after power up. Every time. Is this expected? Or is there something odd going on?

To rephrase, when I start my system (power-up) sending the dummy byte doesn't work (two led blinks per second) until I click the 'reset' button on the device. Is there anyway to not require pressing the reset button on every power up?
drannex42
Freshie
 
Posts: 5
Joined: Sun Dec 06, 2020 2:21 pm

Re: MDDS30 Reset and Dummy Byte

Postby waiweng83 » Fri May 07, 2021 2:29 pm

This is really strange. Did you try to put in some delay after power up the motor driver before sending in the autobaud byte?
This is for the MCU on the motor driver to finish its initialization process.

I do not have data of how long the delay it should be for now. Maybe just start with some pretty long delay like 500ms and gradually reduce it.
With the power of dream, nothing is impossible...
User avatar
waiweng83
Moderator
 
Posts: 208
Joined: Wed Apr 15, 2009 2:17 pm

Re: MDDS30 Reset and Dummy Byte

Postby drannex42 » Sun May 09, 2021 4:58 am

Yes.I've even tried:
- opening the port, adding a delay, and then sending a write command.
- opening the port, sending the command, and then adding a delay.
- opening the port, adding a delay, sending the command, closing the port, opening the port, and then sending the other values.

All of this do not work as thought, until I press the reset button.I've tried delays from 500msec to 5 seconds, and still all the same issues.
drannex42
Freshie
 
Posts: 5
Joined: Sun Dec 06, 2020 2:21 pm

Re: MDDS30 Reset and Dummy Byte

Postby drannex42 » Sun May 09, 2021 5:59 am

I have somewhat spotted the error, this does not seem to be a MDDS30 issue, but rather a serial port config issue with some onboard drivers when using a USB -> TTY converter.

When i wrote this in C I was using the built in open() function that writes to a 'file' called USB/ttyUSB0, where my device is connected. When I ported this code to Julia, and finally to Rust, I decided to use built in 'serialport' libraries. Writing to the file seems to work, but when writing via a serialport library it corrupts data outside of a few bytes and when instantiating with autobaud it confuses the MDDS30 when the handshake occurs. This does not appear to be an issue on Windows, but on Linux.

After I wrote my last comment I decided to start looking through my port() functons, and replace with a
CODE: SELECT_ALL_CODE
std::fs::File
operator instead of the
CODE: SELECT_ALL_CODE
std::boxed::Box<dyn serialport::SerialPort>
that I was given.

I appear to have solved the issue, and will see if the MDDS30 has any issues with the way autobaud detects when using other types of serialport libraries.

tl;dr: When using a USB to TTY converter to communicate, be sure to use a file writer instead of more standard serial port libraries.
drannex42
Freshie
 
Posts: 5
Joined: Sun Dec 06, 2020 2:21 pm

Re: MDDS30 Reset and Dummy Byte

Postby gh9st » Mon Apr 25, 2022 11:10 am

Thanks for your response. I have been having issues using 2 MDDS30 at the same time using 2 CP2102 USB to ttl converters. I am using the Pyserial library for python, and at first was using packet serial mode, but got tired of trying to figure it out and now I am having a hard time getting serial simplified to work right. The devices only receive the first command that is written to the serial port. This is my first time using UART for communications on a pi, so I am new to serial in python. When I get back to my shop I will share my code, but if someone could tell me how to send the packets, I would appreciate it. Im using 2 MDDS30 with 4 motors, and have mapped my mecanum drive speed control to 0-63, and back motor controllers are ttyUSB0, front ones are ttyUSB1, direction is passed as 0 for reverse and 1 for forward, speed is converted to binary, filled with zeros until the length is 5 bits, and then converted to string, and then my packet is concatenated, then encoded to bytes. Output written to serial is b'0110000 for front right motor at 0 speed, and b'01111111 for speed at 63. Any quick ideas on what im not grasping?

I got the controllers working great using:
Adafruit servo hat, connected to RC pins, and using the continuous servo library to set the throttle (-1 to 1). This works great, but I wanted to see if serial was more efficient, as my joystick inputs are sent over MQTT remotely. Now, I haven't really got lag, but I also havent added anything else but the motor controllers and servo hat on the PI. I also think I am not getting full speed output this way.
gh9st
Fledgling
 
Posts: 1
Joined: Mon Apr 25, 2022 10:53 am

Re: MDDS30 Reset and Dummy Byte

Postby alishakihn » Wed Dec 06, 2023 10:04 am

Verify that your communication settings, such as baud rate, data format (parity, stop bits), and flow control, are correctly configured on both the MDDS30 device and the controlling device (microcontroller, computer, etc.). Mismatched settings can lead to communication issues.
Run 3
alishakihn
Greenhorn
 
Posts: 2
Joined: Mon Sep 11, 2023 8:55 pm

Re: MDDS30 Reset and Dummy Byte

Postby ScotNygaro » Wed Feb 07, 2024 3:26 pm

Ensure that your system provides enough time for the MDDS30 to stabilize after power-up. Some devices may require a brief delay before they are fully operational. rice purity test
ScotNygaro
Fledgling
 
Posts: 1
Joined: Wed Feb 07, 2024 3:24 pm


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 25 guests

cron