tarm / serial

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Having 0x10 set causes arduino to reset when serial message is sent

ASoggyToaster opened this issue · comments

func setCommState(h syscall.Handle, baud int, databits byte, parity Parity, stopbits StopBits) error {
	var params structDCB
	params.DCBlength = uint32(unsafe.Sizeof(params))

	params.flags[0] = 0x01  // fBinary
	params.flags[0] |= 0x10 // Assert DSR

Having 0x10 set causes arduino to reset when serial message is sent when connecting via windows. I modified my copy of the library to remove this line.

func setCommState(h syscall.Handle, baud int, databits byte, parity Parity, stopbits StopBits) error {
	var params structDCB
	params.DCBlength = uint32(unsafe.Sizeof(params))

	params.flags[0] = 0x01  // fBinary
	//params.flags[0] |= 0x10 // Assert DSR

Currently using it in this project: https://github.com/ASoggyToaster/Max7219

Submitted a PR: #89

jeez I wasted so much time yesterday trying to figure out why my Arduino was resetting when I sent data using this library. Thanks for finding out wha the problem is.

Happens in OS X too. I would not say this is a library problem specifically but it would be great to make this behaviour configurable.

Agreed - Probably shouldn't have submitted this as a PR per se, but having it open - I think - is helpful to others who may experience the same issue.

In this instance I made the quick and dirty change that suited my usecase, but glad it helped you as well @donotnoot !