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: 189
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


Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 1 guest

cron