Skip to content

Invalid serial port error trying to open CH343G based serial port #158

@nnnpa31

Description

@nnnpa31

When does it happen
This error is reported when I open /dev/ttyCH343USB0.

What module
The device model is CH343G.

System and version information
Ubuntu 22.04, Go 1.20

Code

package main
...
func main() {
    mode := &serial.Mode{
	BaudRate: 921600,
	DataBits: 8,
	StopBits: 1,
	Parity:   serial.NoParity,
    }
    port, err := serial.Open("/dev/ttyCH343USB0", mode)
    if err != nil {
        panic(err) // The error happen here.
    }
    defer port.Close()
}

What's return

panic: Invalid serial port

More infomation
The same code and device can run on Windows, just replace /dev/ttyCH343USB0 with COM7.

I don't know what other information I need to provide about this. If you need it, please let me know and I will provide it as soon as possible.

Update: I can use the same settings to open it in the serial module of other languages.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions