GPIO confusion

7 views
Skip to first unread message

Gregg Carlson

unread,
Jul 15, 2015, 2:40:51 PM7/15/15
to devT...@googlegroups.com
I'm primarily interested in 2 or 3 pins of I/O and trying to hack that outcome through Gcode - any help or comments appreciated.

For some reason, I don't find any docs/examples relating to this hardware interface or how PWM quite works - or what the electrical
spec is (maybe I missed it). I'm curious why there is no open collector/buffers or even relays provided onboard?

There are conflicting terms used on the LEDs vs. the output pins, but their states appears to be identical.

SpOn LED = Spin pin
SpDir LED = Sdir pin

I'll just use the LED terms. To start, PWM is glowing (perhaps pwm'ing) and SpON, SDir, Coolant are off. So, my "hack" -

M7 - coolant pin on
M9 - coolant pin off

M3 - SpOn ON, SpDir OFF
M5 - SpOn OFF, SpDir OFF

M4, M5 - SpOn OFF, SpDir ON
M3, M5 - SpOn OFF, SpDir OFF

In the latter two cases, the other pin will flash between commands - not perfect, but this might work. If I knew a little more about
setting the PWM, perhaps I could set that between 0% and 100% and create a fourth GPIO.

Does this make sense? Is there a better idea - perhaps a hidden command or Gcode to simple toggle these outputs?

Thanks! Gregg


Carl McGrath

unread,
Jul 15, 2015, 5:30:35 PM7/15/15
to devT...@googlegroups.com
Gregg: PWM Glowing may be because $p1pof = 0.10 by default, this says PWM = 10% duty cycle when Spindle is off.
You could toggle it between 0% and almost 100% by setting $p1pof=0.0 and $p1cph=1.0

Spindir is spindle direction, will toggle when you send cw vs ccw S commands.

Do you use Chilipepper?
Someone developed a GPIO Widget to support sending GPIO to a RaspPi (I believe), many folks using RaspPi as host for the SPJS server

This might help with your understanding of PWM settings: https://dl.dropboxusercontent.com/u/50261731/Spindle%20Test%201.doc

Gregg Carlson

unread,
Jul 15, 2015, 5:57:58 PM7/15/15
to devT...@googlegroups.com
Thanks Carl,

No, not using Chilipepr - I'll write a GUI.

Great doc!  I am able to move the PWM pin between states with

$p1pof=0     M5     .01V
$p1pof=1     M5     3.1V

I don't see any effect from $p1cph, though I'm not on a scope.

M3 Sx also of course affects PWM, but it also turns on the SpOn pin.
And, a subsequent M5 restores the PWM to another value; perhaps
a default different than the one set by Sx).

Gregg

--
You received this message because you are subscribed to a topic in the Google Groups "TinyG Development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/devTinyG/VeNeVgqAEr4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to devTinyG+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carl McGrath

unread,
Jul 15, 2015, 6:54:56 PM7/15/15
to devT...@googlegroups.com
Gregg
If you change a $p1xxx parameter, you have to force tinyG to reread it.
I know M3, then M5 works, not sure if M5 alone will work - you will have to experiment.

To make PWM=$p1cph, you have to issue something like M3 S10000, assuming you set $p1csh=10000
I'm not sure how to do that is you want to keep Spin pin separate.
Reply all
Reply to author
Forward
0 new messages