I'm pretty sure it takes as long as the instruction does to process, which is four clock cycles at whatever clock speed you are running at. At 80mhz (with the 5mhz Clock and a 16x PLL selected) you get about 12.5ns per click tick ~= 50ns for the transition.
Good luck finding that spec anywhere. In the datasheet, the "AC Characteristics" section covers only three parameters, and rise and fall times with a specified load are not among them. But I'm sure it's way faster than you need it to be, and much shorter than 12.5 ns. with no load.
Right... however, based on my answer, it won't be longer than 50ns from the time the instruction is first executed. The problem is we simply do not know what the circuit looks like inside the chip to say for sure. The actual transition (from High to Low) is what Phil is referring too and would be quite fast... much faster than 12.5 ns as he states.
I have one part of my cnc that is giving me trouble. It must be a faulty opto-isolator in the drive or something. It changes state, but not as fast as the other drives.
The Step pin for the G251 requires a minimum pulse width of 1us and all of them are currently set at 2us. However, it isn't a step pin that is giving me trouble, it is 1 direction pin out of 8 drives. All of the other drives have no waitcnts set for them, but for this one, I have a waitcnt of 2us to change directions and it is still giving me problems.
This is actually for a wire cutter, which has equivalent steps up and down, and they both use the same function for stepper movement. The only difference is OUTA[Cutter_Direction]~~ and OUTA[Cutter_Direction]~. Here is what the code looks like:
if you consider that there is a frequency synth-object that can create frequencies up to 128 MHz you get a raw estimation on how fast the transition must be
1/ 128MHz is about 7.8 nanoseconds
to create a frequency the transition-time has to be half of that that's about 4 nanoseconds. And I bet it is even lower.
Maybeo PhiPi can setup the synthobject to create 128MHz and make a quick probing with his 2GS DS-Scope and post a picture of it?
Most Optocouplers have a rise/fall time of 1000 to 5000 nanoseonds. (This is the reason why you should use a longer pulsetime than just one microsecond = 1000 nanoseconds)
So the bottleneck is the optocoupler and not the prop.
Anyway what do you want to do IN THE END?
Or is this just out of curiosity and a pure academic question?
Addition: Bruce did you ever finished any other project with steppermotors?
I bet there will be completely different things that will "bite" you before this packaging machine will run flawlessly
Thanks for responding. I am just having troubles with one of my drives. I have not found the cause yet, but at this point I think it is a bad connection going to the step direction pin. I asked the question because I was switching directions without waitcnts (I know before you say it), and I was wondering if the Prop was sending the pulse quick enough. Like I said, I am about 75% certain that it is probably a cold solder joint, but it will have to wait until tomorrow. I am just not up to it tonight. Besides that, it appears that the machine is going to run pretty good. Anyhow have a nice evening.
Bruce,
A troubleshooting technque that I have used successfully over the years is one of isolation. You can saftelyassume that from one channel to another the speed of the prop is not going to change. With that in mind, temporarly move the cutting function to another hardware channel. Reidentify the cutting pin in software and test the function. If the problem follows the change in pin the problem is in software timing if it works on new channel, suspect the hardware, opto, motor etc.
Regards,
RS_Jim
Keep in mind that Spin takes time to execute so there will be minimum delays that you can apply with waitcnt -- it's covered in the manual. From a practical standpoint, I think it's about 5 microseconds.
Yea I did that for another problem that I was having earlier and it helped isolate that problem. Thank you so much for reminding me, that is a FANTASTIC idea!!!!!
To answer your transition speed question - which is probably not your issue - the speed that the prop output changes at is very much a function of the capacitance of the load on the pin. With a 16pF scope probe attached, the transition time is about 2 nano seconds. I would suspect that with a low capacitance 1 pF probe that would drop to less than 1 nano second, but I would need to measure that to make sure. Can do tomorrow if you wish.
Sometimes you guys really make me smile because you are so into this stuff. However, it is an interesting fact to know the answer, at least with 16pF. But as you mentioned this was not my issue. As it turns out, I just needed a sufficient delay for the motor coils to deenergize. So further testing is really not necessary for me, but I am sure there are a few that would like to know the results. Thank you for your time and the test.
Bruce: There seems to be a few things that you may have discovered that are relevant to designs with specific timing requirements.
1. Spin is quite slow and IIRC ~30-70 prop instructions for each bytecode. A bytecode is actually not a spin instruction so there maybe a few bytecodes per spin instruction (simple instruction).
FYI I coded a spin/pasm debugger which counts instructions as well as tracing. It is in the obex under zero footprint debugger (because it lives in the shadow register space $1F0-1F3 of cog ram). It uses a LMM type mode to execute so it is much slower to execute as each pasm instruction is effectively fetched and executed. It is not clock cycle accurate as I do not take into account non-executed jumps that take 8 clocks (remember most non-executed jumps are nops because of the flag testing and so are still 4 clocks!)
2. Waitcnt has a minimum number of counts that can be executed. IIRC pasm is 9 clocks. Spin would be many more, maybe in the order of ~35.
3. Kuroneko plus others, myself included, have worked out some timing diagrams for the instruction that affect pins. Kuroneko is the expert. Chip has given us (publicly) info regarding the internal delays which IIRC are ~3nS. The big thing here is Parallax are very open about things but it can take time to get the answers depending on their workload. Ken (Chip's brother) is the major interface for us on the forum.
4. You will not I have not addressed the rise/fall time of the switching.
5. Optos usually are quite slow so you may need to find a specific device for the speed you require.
Not at the moment, my head is swelling from a rough week of trying to get the steppers to run well. I think my bender CNC is just about ready for production, however, I still have to program the user interface. I am not looking forward to that task. If only I could find my magic wand The machine runs pretty good, but it needs a few things shored up. And the packaging machine should be a cake walk.
Thanks for the offer though. I am sure that by another year in this forum, I should be an old hack at this stuff.
Bruce: Yes, you have jumped right in at the deep end and there is always lots to learn. At least there is lots of help here although you do have to sort through the chaff sometimes. And as you have found, Parallax is really helpful.
BTW in case you don't know, Chip Gracey is Mr Parallax and Ken is his brother. Ken is extremely helpful and relieves Chip from interruptions to get us the Prop II asap There are many others at Parallax - they all have the same helpful spirit. If I was a bit younger and not in Oz, I would love to work there.
Comments
Bill
Bruce
-Phil
I have one part of my cnc that is giving me trouble. It must be a faulty opto-isolator in the drive or something. It changes state, but not as fast as the other drives.
Bruce
-Phil
The Step pin for the G251 requires a minimum pulse width of 1us and all of them are currently set at 2us. However, it isn't a step pin that is giving me trouble, it is 1 direction pin out of 8 drives. All of the other drives have no waitcnts set for them, but for this one, I have a waitcnt of 2us to change directions and it is still giving me problems.
This is actually for a wire cutter, which has equivalent steps up and down, and they both use the same function for stepper movement. The only difference is OUTA[Cutter_Direction]~~ and OUTA[Cutter_Direction]~. Here is what the code looks like:
And yes the prop is driving it and if you notice I have also include a waitcnt above and below direction change
Bruce
Additionally this is just a test run. It is not actually cutting wire at the moment and there is very little load on the stepper.
Bruce
if you consider that there is a frequency synth-object that can create frequencies up to 128 MHz you get a raw estimation on how fast the transition must be
1/ 128MHz is about 7.8 nanoseconds
to create a frequency the transition-time has to be half of that that's about 4 nanoseconds. And I bet it is even lower.
Maybeo PhiPi can setup the synthobject to create 128MHz and make a quick probing with his 2GS DS-Scope and post a picture of it?
Most Optocouplers have a rise/fall time of 1000 to 5000 nanoseonds. (This is the reason why you should use a longer pulsetime than just one microsecond = 1000 nanoseconds)
So the bottleneck is the optocoupler and not the prop.
Anyway what do you want to do IN THE END?
Or is this just out of curiosity and a pure academic question?
Addition: Bruce did you ever finished any other project with steppermotors?
I bet there will be completely different things that will "bite" you before this packaging machine will run flawlessly
best regards
Stefan
Thanks for responding. I am just having troubles with one of my drives. I have not found the cause yet, but at this point I think it is a bad connection going to the step direction pin. I asked the question because I was switching directions without waitcnts (I know before you say it), and I was wondering if the Prop was sending the pulse quick enough. Like I said, I am about 75% certain that it is probably a cold solder joint, but it will have to wait until tomorrow. I am just not up to it tonight. Besides that, it appears that the machine is going to run pretty good. Anyhow have a nice evening.
Thanks for responding
Bruce
A troubleshooting technque that I have used successfully over the years is one of isolation. You can saftelyassume that from one channel to another the speed of the prop is not going to change. With that in mind, temporarly move the cutting function to another hardware channel. Reidentify the cutting pin in software and test the function. If the problem follows the change in pin the problem is in software timing if it works on new channel, suspect the hardware, opto, motor etc.
Regards,
RS_Jim
Yea I did that for another problem that I was having earlier and it helped isolate that problem. Thank you so much for reminding me, that is a FANTASTIC idea!!!!!
Bruce
To answer your transition speed question - which is probably not your issue - the speed that the prop output changes at is very much a function of the capacitance of the load on the pin. With a 16pF scope probe attached, the transition time is about 2 nano seconds. I would suspect that with a low capacitance 1 pF probe that would drop to less than 1 nano second, but I would need to measure that to make sure. Can do tomorrow if you wish.
Cheers,
Peter (pjv)
Sometimes you guys really make me smile because you are so into this stuff. However, it is an interesting fact to know the answer, at least with 16pF. But as you mentioned this was not my issue. As it turns out, I just needed a sufficient delay for the motor coils to deenergize. So further testing is really not necessary for me, but I am sure there are a few that would like to know the results. Thank you for your time and the test.
Bruce
1. Spin is quite slow and IIRC ~30-70 prop instructions for each bytecode. A bytecode is actually not a spin instruction so there maybe a few bytecodes per spin instruction (simple instruction).
FYI I coded a spin/pasm debugger which counts instructions as well as tracing. It is in the obex under zero footprint debugger (because it lives in the shadow register space $1F0-1F3 of cog ram). It uses a LMM type mode to execute so it is much slower to execute as each pasm instruction is effectively fetched and executed. It is not clock cycle accurate as I do not take into account non-executed jumps that take 8 clocks (remember most non-executed jumps are nops because of the flag testing and so are still 4 clocks!)
2. Waitcnt has a minimum number of counts that can be executed. IIRC pasm is 9 clocks. Spin would be many more, maybe in the order of ~35.
3. Kuroneko plus others, myself included, have worked out some timing diagrams for the instruction that affect pins. Kuroneko is the expert. Chip has given us (publicly) info regarding the internal delays which IIRC are ~3nS. The big thing here is Parallax are very open about things but it can take time to get the answers depending on their workload. Ken (Chip's brother) is the major interface for us on the forum.
4. You will not I have not addressed the rise/fall time of the switching.
5. Optos usually are quite slow so you may need to find a specific device for the speed you require.
I hope this helps you find what you are after
But that was way over my head LOL I think I knew a few words there
I hope all is well you.
Bruce
Not at the moment, my head is swelling from a rough week of trying to get the steppers to run well. I think my bender CNC is just about ready for production, however, I still have to program the user interface. I am not looking forward to that task. If only I could find my magic wand The machine runs pretty good, but it needs a few things shored up. And the packaging machine should be a cake walk.
Thanks for the offer though. I am sure that by another year in this forum, I should be an old hack at this stuff.
Bruce
BTW in case you don't know, Chip Gracey is Mr Parallax and Ken is his brother. Ken is extremely helpful and relieves Chip from interruptions to get us the Prop II asap There are many others at Parallax - they all have the same helpful spirit. If I was a bit younger and not in Oz, I would love to work there.