Skip to content

VS Code extension on macOS: Deploy fails with "Could not connect to <port> to verify device compatibility" (debug bridge gets no ping reply at 921600 baud on a CH340 adapter) #1942

Open

Description

@delfuria

Tool

Visual Studio extension

Description

The nanoFramework Deploy command in the VS Code extension stops after the build with:

Could not connect to /dev/tty.usbserial-110 to verify device compatibility.

The device runs nanoFramework and the application (LED blink) is running. nanoff works on the same port at 115200 baud.

The message comes from checkDeploymentCompatibility() in out/dotnet.js, which starts nanoDebugBridge and sends
initialize then connect. The bridge replies:

{"id":2,"success":false,"error":"Device '/dev/cu.usbserial-110' not found. Make sure it's connected and running nanoFramework."}

What I found:

  • I drove the bridge by hand with JSON lines on stdin (dotnet nanoFramework.Tools.DebugBridge.dll). Same result with
    /dev/cu.usbserial-110 and /dev/tty.usbserial-110.

  • Using nanoFramework.Tools.DebugLibrary.Net.dll directly: PortSerial.ConnectDevice() returns Connected, then
    engine.Connect(...) returns False at 921600, 460800 and 115200, also after waiting 6 seconds for the board to boot.

  • The device does answer a Wire Protocol ping, but not at 921600. I sent a Monitor_Ping packet by hand with pyserial
    (marker NFPKTV1\0, flags 8192, payload Source=0, Flags=1, CRC32 non-reflected, polynomial 0x04C11DB7, init 0,
    copied from the decompiled library) after an RTS reset:

    Host baud Reply
    9600, 57600, 921600, 1500000, 2000000, 3000000 none
    880000 to 990000 (10 kHz steps) none
    115200 / 230400 / 460800 4 / 8 / 16 garbage bytes
    1000000 to 1060000 32 or 64 bytes, header-like, with bit errors

    At 1,000,000 baud I get 4e c6 50 8b 54 96 31 00 ...; the expected marker NFPKTV1\0 is
    4e 46 50 4b 54 56 31 00. Bit 7 is set on some bytes, consistent with a baud rate mismatch.

  • My hypothesis, not verified: the CH340 with the macOS built-in driver does not generate 921600 baud accurately.
    I have not tried the WCH vendor driver or another USB-serial chip.

  • The boot log at 115200 shows the CLR starting normally (App version: 1.18.0.561, main_task: Calling app_main()).

How to reproduce

  1. macOS with a CH340-based ESP32-CAM-MB adapter, firmware ESP32_CAM_REV3 1.18.0.561, and a project that builds with
    the extension.
  2. Get the app running on the device, for example with
    nanoff --platform esp32 --serialport /dev/cu.usbserial-110 --baud 115200 --deploy --image Consoleapp1.bin --address 0x1E0000 --reset
    (the address is needed because of issue 1: <link to issue 1>).
  3. In VS Code, run the nanoFramework Deploy command and choose the port.
  4. The error above appears and nothing is deployed.

Expected behaviour

Deploy works, or reports a clear reason (for example "no reply at 921600, retry at a lower baud rate"). Ideas:

  • Allow configuring the debug bridge baud rate, or fall back to lower rates.
  • Let the user skip the compatibility check, or fall back to nanoff when the bridge cannot reach the device.

Relation to #1837

#1837 is also about the VS Code extension on macOS (Apple Silicon) talking
to an ESP32 through the debug bridge, but it is a different failure and it is closed:

  • Unable to debug in VS Code in macOS #1837 is a debug session, with extension 1.0.247, where the bridge crashes with System.AccessViolationException
    in GlobalExclusiveDeviceAccess.GetOrCreate right after Connecting to device ... at baud rate 921600. It was fixed in
    a later version.
  • Here the extension is 1.0.364, the bridge does not crash, it returns Device '...' not found from connect,
    and the failing step is the Deploy compatibility check. I traced it to engine.Connect(...) getting no reply.
  • The Unable to debug in VS Code in macOS #1837 reporter's port is /dev/cu.usbserial-A5069RR4, which looks like an FTDI-style serial number, and it
    worked after the fix. Mine is a CH340 (/dev/cu.usbserial-110, vendor ID 0x1A86), which supports my suspicion that
    the adapter/driver matters. I did not verify that.

Screenshots

No response

Aditional context

  • Visual Studio version: not used (Visual Studio Code 1.143.1, arm64, macOS, Darwin 24.6.0)
  • .NET nanoFramework extension version: nanoframework.vscode-nanoframework-1.0.364
  • Tool versions: nanoff 2.5.169+a727d21aed, Mono 6.12.0.206 (msbuild 16.10.1), .NET SDK 10.0.203
  • Target name(s): ESP32_CAM_REV3
  • Firmware version: 1.18.0.561 (ESP-IDF v5.5.6)
  • Device capabilities output: not available, the bridge cannot connect. nanoff --devicedetails output:
    ESP32 (ESP32-D0WD-V3 (revision v3.1))
    Features Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None
    Flash size 4MB unknown from  (manufacturer 0x85 device 0x1620)
    PSRAM: undetermined
    Crystal 40MHz
    
  • Libraries: CoreLibrary 1.17.11, System.Device.Gpio 1.1.64, Runtime.Events 1.11.39. The native checksums in the .pe
    files match the firmware's native_assemblies.csv (mscorlib 0x1549C856, System.Device.Gpio 0x097E7BC5,
    Runtime.Events 0x0EAB00C9).
  • Hardware: ESP32-CAM AI-Thinker with ESP32-CAM-MB adapter, ESP32-D0WD-V3 rev v3.1, 4 MB flash, 8 MB PSRAM.
    USB-serial chip WCH CH340/CH341 (vendor ID 0x1A86), macOS built-in driver.
  • Even if the check passed, the extension runs nanoff without --address, which is wrong for this firmware
    (issue 1).
  • Found along the way: System.Device.Gpio needs nanoFramework.Runtime.Events. When it is not referenced the
    project builds, the image only contains mscorlib and System.Device.Gpio, and the app silently does not start.
    I added the package by hand.
  • nanoff --listdevices reports "No devices found" for this ESP32 while it is connected and running nanoFramework;
    I assume it only lists USB devices.

Activity

  1. delfuria commented on Oct 29, 2026

    @delfuria
    Author

    Update: the problem is the USB-serial driver, not the bridge.

    With the macOS built-in driver the CH340 (vendor ID 0x1A86) cannot communicate at 921600 baud. After installing the
    WCH CH34x driver (https://github.com/WCHSoftGroup/ch34xser_macos), the port becomes /dev/cu.wchusbserial110 and:

    • A hand-made Monitor_Ping at 921600 baud now returns a clean NFPKTV1\0 marker (80 bytes). Before, nothing arrived
      at 921600, and above 1,000,000 baud the frame had flipped bits.
    • The debug bridge connects:
      [nF-Debug] Found device: ESP32_CAM_REV3 @ /dev/cu.wchusbserial110
      [nF-Debug] Connected successfully!
      
    • nanoff --nanodevice --devicedetails --serialport /dev/cu.wchusbserial110 reports:
      HAL build info: nanoCLR running @ ESP32 built with ESP-IDF v5.5.6
        Target:   ESP32_CAM_REV3
        Platform: ESP32
      Firmware build Info:
        Date:        Oct 28 2026
        Type:        MinSizeRel build, chip rev. >= 3, support for PSRAM
        CLR Version: 1.18.0.561
      Assemblies:
        mscorlib, 1.17.11.0
        nanoFramework.Runtime.Events, 1.11.39.0
        System.Device.Gpio, 1.1.64.0
        Consoleapp1, 1.0.0.0
      

    So this report is a driver limitation on macOS with CH340 adapters, and the bridge is fine. What could still be improved
    in the extension:

    • When the ping gets no reply, the message "Could not connect to to verify device compatibility" does not say why.
      A hint such as "no reply at 921600 baud: check the USB-serial driver/adapter, or try another cable" would have saved a lot
      of time.
    • The README or the docs could mention that CH340/CH341 adapters on macOS may need the WCH driver (the macOS driver
      page of the extension, if it exists, is a good place).

    Feel free to close this issue or to retitle it as a documentation/diagnostics improvement.

    Update: with the WCH driver the extension's Deploy command also works end to end on this setup (compatibility check passes, nanoff --nanodevice --deploy runs, the new build runs on the device).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions