highest stepper speed and dmx or homemade rs485 dataprotocol

how is the reading of the data-protocol(dmx) not going to interfere with pulsing a digital output.

How is the AVR going to check and read a DMX signal, while simultaneously pulsing the motors to its next move?

The driver i use is: DRV8825;
250khz,
Pulse high min 1.9 us,
Pulse low min 1.9 us,

So lets state i want to pulse 2 steppers at this maximum speed and read an DMX signal.
this would mean i have a 1.9us downtime to make the chip, read dmx signals, potentional other signals and convert them to do what i want.

using a timer, brings options. Like in Accelstepper, i call a function to check if it is time for a step. This is called run().

run();
readDMX();
run();
updatetargetpositions();
run();
readDMX();
run();
calculateSomethingMoreDifficult();
run();
readDMX();

Like this other tasks than pulsing will be spread around the downtime.

Ok how should i approuch this in a more succefull way? the dmx readouts are delaydriven idea's
and will I not be either missing data or missing smooth motion going about it like this.

Did i miss something entirely?

The 1.9 us time is the minimum pulse time; there is no maximum pulse time. At any rate I don't think you'll find a commodity stepper motor that would be able to spin as quickly as the DRV8825 could pulse it; you're looking at pulse times, minimum, around 100 us. But if you really need to spin something that quickly then you should either increase the gear ratio or get away from stepper motors.

The hardware serial of an Arduino will hold 64 bytes of data. Your program doesn't need to be "stopped" as the data is transferred.

With respect to running multiple functions but not "every loop" the basic methods are to either increment function-specific counters in the loop and only run calculateSomethingMoreDifficult() once every 10 loops or you can record the time of the last execution of a particular function and not re-execute unless a set amount of time has elapsed.

If you have a motor that can accept steps at 250kHz then you probably (almost certainly) need something faster than a 16MHz Arduino to drive it.

On the other hand if you have a more normal stepper motor that works at a much lower max step speed there is no problem managing stepping in pseudo parallel with other code.

...R

I can use a lot of other ways of driving something fast, this was not the point.

The point I missed was the serial databuffer.
I was afraid that when the run(); function would be running a startbit would be missed. But i understand now that this does not happen, due to the databuffer.

i use a normal stepper, but i want to use microstepping to solve the non smooth motion.
This driver has 32 microstepping modus available, this means that a normal 1.8 degree stepper(200), needs :
32*200 = 6400 pulses/rev
6400 pulses * (1.9+1.9) = 24320 us/revolution.

1.000.000 / 24320 = 41.1 rev/sec
41.1 rev/sec x 60 = 2467 RPM.
Not so incredibly fast, but definitely quick.

I think having half of that speed would be plenty for me. however... 16mhz maybe not enough.

The RepRap interface (GRBL) manages up to 30KHz step rates. With the microstepping you're at 6400 * 41 = ~262KHz for one stepper. You're asking too much.

Thank you, i love asking 2 much. :slight_smile: sets a goal. :slight_smile: