From nobody Tue Jan 14 20:48:04 2025 X-Original-To: usb@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YXh6D6lYrz5kPSW for ; Tue, 14 Jan 2025 20:48:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YXh6D5smpz4KTY for ; Tue, 14 Jan 2025 20:48:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736887684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h5b/Xkdt+FY4V7xE0CCPpL6mI/KGFHUWWC1j8cb0YOY=; b=F6pmwKuIbtX460Wf3aEQSJyMDOrIQq9nr1VsrSf0H1aMkoHkFgsfSo+6NV1QBoSDRNJnk1 IpDAUDgLfYx4Y/b5qSv9hmnmoeCgJVBSw/Nina9YDIBJ3vV2/FU1zeEcHirwMkQurg0c8A 6f+1MyFTXUjPcVtrUnKBCOdLtK3jQMqS0lBckuhn/xYQZ0fYXzxnozIJAh5s6xJrdfr6Pc T9ybkn6lclaHkDFhOObWFQ3gepDyoeamdJ9QN7EuqqkunnPXJpfpfnLdLN8Ai4plkAseS6 RRQ6MnqHyzg9AyTH0KsV8g0ysNLyNFkkRojLOyRagXVPEYEu0m0nkclvNz4oIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736887684; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=h5b/Xkdt+FY4V7xE0CCPpL6mI/KGFHUWWC1j8cb0YOY=; b=Tq5DUVIWM2hfyFt5QX/ZpIUfahLIkN1PdUuD7lPKjNbPuvqGNDjx/cUQoqCdXccpeQ7/WV kD45FpXOgB39ecfmMcMRy6vgw3TflpVFBunEiE8/n6NiUtvsWF5IqDKDDXe/o1BfrL8TC8 1+WKrDu7rLbL6W6X52kDX4P+aZ8+JEVMqubx49ZX2+iXOPoSE7OqOa+H43ZQUraKl6+jjJ ZzPY/3FIDCgOTX2PrcAiG3YUzScoPqTC9+YMff/B+hiPZdSH+9ffynQwZgNocEI+rYwzVE Rl/6gLQ0t7R6sBDNgaBmYnP/N9xpwc3/3QStN5TENAQMEs3TkYJtzVOEx035Hw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736887684; a=rsa-sha256; cv=none; b=M2eAcCPs+zbjff6Ok9Rx752/WIzHlYVJydIjWBt6yzsgfYjmlK8zGekGiQHpHTPw0BhNS1 KMws1BQ8g4TviP951mSmS+IbFv/aN7rVAujRmZeZwdYESthrxkwmKD18CZCSH+RL0VTcSF kPQnIWprOE/uhbMNNbZBjdnbTOV7czQ8Wq9YHsathde/gocOkAel0P6wOnMlT+BIoL40s0 w003lumJ+lwQo/BuqhrhAvuj48nS3x3QfP1mtdT8ec2NWVrm8+QFQA5px+sju9YUNWM85v mJzoQfZzmICeYqSvbaYNtVzoiH4aLu2PVLKH+BNpFaZ27Ngl8GgQB8PRIx/r8Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YXh6D523Pz1hW for ; Tue, 14 Jan 2025 20:48:04 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 50EKm4S0031236 for ; Tue, 14 Jan 2025 20:48:04 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 50EKm4kH031235 for usb@FreeBSD.org; Tue, 14 Jan 2025 20:48:04 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: usb@FreeBSD.org Subject: [Bug 284042] FTDI: UART breaks JTAG Date: Tue, 14 Jan 2025 20:48:04 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: usb X-Bugzilla-Version: Unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: bsd@orsolic.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: usb@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-usb List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-usb@freebsd.org Sender: owner-freebsd-usb@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D284042 --- Comment #6 from bsd@orsolic.org --- I modified driver directly, recompiled it, reloaded it and then tried to do= the experiment again (no reboots needed): sys/dev/usb/serial/uftdi.c is_jtag_interface(struct usb_attach_arg *uaa, const struct usb_device_id *i= d) /* We only allocate 8 flag bits for jtag interface flags. */ if (uaa->info.bIfaceIndex >=3D UFTDI_JTAG_IFACES_MAX) return (0); + if (uaa->info.bIfaceIndex =3D=3D 0) return 1; kldunload uftdi; kldunload ucom.ko ; rm /boot/kernel/uftdi.ko ; make && ma= ke install ; kldstat | grep -E 'ftdi|ucom' You'll need to disconnect USB device before unloading, otherwise it will fa= il to unload driver and report it is busy. It seems that JTAG and UART can't work simultaneously on Windows. I won't exclude that I did something wrong, there is almost 2 decades since I activ= ely used Windows. I did try to reprogram some things with FT tool in Windows (like use D2xx drivers instead of VCP for channel A) but it doesn't make difference. Linux creates two devices: /dev/ttyUSB0 and /dev/ttyUSB1. I think that is t= o be expected because FT2232H starts as 2x UART and if you want to make it JTAG/MPSSE you need to send commands to reconfigure it (which OpenOCD does). I didn't find a way to configure it at start as JTAG. Linux dmesg: [177342.561849] usb 1-1: new high-speed USB device number 5 using xhci_hcd [177342.785324] usb 1-1: New USB device found, idVendor=3D0403, idProduct= =3D6010, bcdDevice=3D 7.00 [177342.785336] usb 1-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D0 [177342.785341] usb 1-1: Product: USB <-> Serial Converter [177342.785345] usb 1-1: Manufacturer: FTDI [177342.798117] ftdi_sio 1-1:1.0: FTDI USB Serial Device converter detected [177342.798181] usb 1-1: Detected FT2232H [177342.798544] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB0 [177342.801090] ftdi_sio 1-1:1.1: FTDI USB Serial Device converter detected [177342.801153] usb 1-1: Detected FT2232H [177342.801576] usb 1-1: FTDI USB Serial Device converter now attached to ttyUSB1 After running OpenOCD /dev/ttyUSB0 disappears. JTAG continues to work after using UART - so, problem is in FreeBSD uftdi driver. I didn't buy original Blackmagic Probe, I am using plain STM32F4 "blackpill" board from AliExpress. It has USB DFU so you can flash BMP firmware on it w= ith flashrom, without external progrmmer. Hmm, so JTAG and RV support should be already in tree (I don't see that C3 = is merged into master/main), "only" flashing part is missing. I know I did wor= k on flash support for unsupported AT32 MCU and managed to do it (it was very similar to STM32 F1 IIRC), so, "how hard it could be?". Seems like a weekend project for many months, erm weeks :) It would be great if ESP32-C3 could be used as JTAG and UART - it is much cheaper and much smaller than FTDI's chip ($7 per chip in QFN-64 packaging). Are you sure that is possible? If it is possible I am wiling to sacrifice s= ome of my C3s just to try it. ESP32 chips (at least C3 and P4) have ability to use internal JTAG or exter= nal JTAG. To use external JTAG you'll need to burn fuse to disable internal JTA= G. Then connect external JTAG to pins (TDI, TDO, TCK, TMS). Are you sure that you are not mixing using external JTAG with ESP32-C3 with using ESP32-C3 as external JTAG? --=20 You are receiving this mail because: You are the assignee for the bug.=