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

250K baud #94

Open
charles-d-burton opened this issue Jan 1, 2019 · 5 comments
Open

250K baud #94

charles-d-burton opened this issue Jan 1, 2019 · 5 comments

Comments

@charles-d-burton
Copy link

I'm trying to adapt this code to support a 250000 baud rate for 3D printers. Unfortunately I don't fully understand how I would interface with the kernel to achieve this. Mostly I'm trying to use idiomatic go but the syscall package doesn't support non-standard baud rates. My plan was to build a function that will handle non-standard baud rates then rather than throwing an error and would instead emit a warning about using a non-standard baud rate, then attempt to set it. Is there anything someone can point me to that would allow for this?

@xiegeo
Copy link

xiegeo commented Jan 5, 2019

Which operating system are you using? You should just modify the serial_[os].go file, otherwise, you are just reimplementing the entire feature.

@charles-d-burton
Copy link
Author

I'm using raspbian, the problem is that this project uses the built in serial interface for Linux which only supports standard baud rates. There's a newer interface called termios2 in the kernel that allows arbitrary baud rates. I found a project that does work with termios2 from golang and I've tested it against my 3D printer, if anyone is interested I can port the work over here and make a PR so that this project can support more arbitrary baud rates in Linux.

@mpictor
Copy link

mpictor commented Mar 22, 2019

Have you actually tried 250k? It's in the source, so seems safe to assume it is supported - see line 42 of
https://github.com/tarm/serial/blob/master/serial_linux.go#L42

Edit: nevermind, that's got an extra 0 - it's 2.5M 😳

@kris14an
Copy link

@charles-d-burton did you try port this library to terminos2 to support 250k baudrate?

@charles-d-burton
Copy link
Author

charles-d-burton commented Dec 11, 2019

@charles-d-burton did you try port this library to terminos2 to support 250k baudrate?

@kris14an I did, the code is over here:
https://github.com/charles-d-burton/serinit

It supports auto-detection or you can specify the device with the struct that I export. It also uses chans for async communication. Always open to improvements and PRs if you're interested.

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

4 participants