Skip to content

COM port won't read - Toit on Windows desktop #2977

@milkmansson

Description

@milkmansson

Using the following on Windows, attempting to run on the desktop directly:

import uart

DEVICE := "COM12"
BAUD   := 9600

main:
  uart := uart.Port DEVICE --baud-rate=BAUD
  print "Started..."
  reader := uart.in
  while true:
    print reader.processed
    print reader.read.to-string
    sleep --ms=10

... results in no data, and the code blocking on print reader.read.to-string.

  • Testing using a known good 9600 source, which connects OK with putty using the same device string.
  • Connecting first with putty, not closing, and trying to run this on toit results in EXCEPTION error. PERMISSION_DENIED (as expected).
  • Connecting first with toit, leaving it blocking, and then trying to open with putty results in 'access denied' (as expected).
  • Tried using admin elevated powershell on windows, no dice.
  • Tried exact code in a linux VM on the same windows install: works perfectly with no hardware change (except change DEVICE := "/dev/ttyUSB0")

I have a Mac at my disposal somewhere, I'll give that a go if you need.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions