Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open drain outputs #11

Closed
jimfong1 opened this issue Apr 21, 2018 · 7 comments
Closed

Open drain outputs #11

jimfong1 opened this issue Apr 21, 2018 · 7 comments

Comments

@jimfong1
Copy link

Is there a easy way to set the LPC pin config to open drain output for using external stepper drivers with optoisolators?

Thanks

Jim

@tbfleming
Copy link
Collaborator

You'll have to add initialization code to do it. Be careful though; if I remember right 5V optos will fry the device without a voltage converter. If you use a voltage converter IC, then you won't need open drain.

@jimfong1
Copy link
Author

I would like to set the Z axis to open drain
Step pin is LPC_GPIO2 pin 3
Dir pin is LPC_GPIO0 pin 20

So the init code is something like this, I think....
LPC_PINCON->PINMODE_OD2 |= 1<<3; //Bit P2.3 is open drain
LPC_PINCON->PINMODE_OD0 |= 1<<20; //Bit P0.20 is open drain

I'm using both smoothieware and grbl-lpc, switch back an forth between them. Grbl works faster for laser rastering. I have a external driver on Z and its easy to set open drain in smoothieware by appending "o" in the config.txt pin configuration. Z driver works fine with smoothieware set to open drain. However would like to set grbl-lpc for open drain too so there would not need additional hardware changes. Not sure if the above code snippet is correct.

@tbfleming
Copy link
Collaborator

It looks correct.

@jimfong1
Copy link
Author

Thanks I got it working. Had to figure out the pinmode selection to turn off the internal pullup, which is default on.

@moors7
Copy link

moors7 commented Apr 2, 2019

Sorry to resurrect this, but I was wondering if one of you could share what exactly needs to be changed in order to enable these open-drain outputs, and where these changes need to be made. Currently running a smoothieboard on a DIY laser, all external drivers. I think I've damaged my Alpha driver, so using the Gamma one for X. I've swapped the pin mappings in cpu_map.h, but can't seem to find where I'd need to make changes to enable the open-drain configuration.
Any and all assistance would be greatly appreciated. Let me know if you require additional information.

@jimfong1
Copy link
Author

jimfong1 commented Apr 2, 2019 via email

@cprezzi cprezzi closed this as completed Nov 13, 2019
@johnsonm
Copy link

johnsonm commented Jan 9, 2020

@cprezzi 's grbl-LPC now has native open drain support, based on the open drain support in @jimfong1 's code but without all the other changes:
cprezzi@47248cb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants