[Bug 284042] FTDI: UART breaks JTAG
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 284042] FTDI: UART breaks JTAG"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 14 Jan 2025 20:48:04 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=284042 --- 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 *id) /* We only allocate 8 flag bits for jtag interface flags. */ if (uaa->info.bIfaceIndex >= UFTDI_JTAG_IFACES_MAX) return (0); + if (uaa->info.bIfaceIndex == 0) return 1; kldunload uftdi; kldunload ucom.ko ; rm /boot/kernel/uftdi.ko ; make && make install ; kldstat | grep -E 'ftdi|ucom' You'll need to disconnect USB device before unloading, otherwise it will fail 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 actively 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 to 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=0403, idProduct=6010, bcdDevice= 7.00 [177342.785336] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0 [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 with 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 work 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 some of my C3s just to try it. ESP32 chips (at least C3 and P4) have ability to use internal JTAG or external JTAG. To use external JTAG you'll need to burn fuse to disable internal JTAG. 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? -- You are receiving this mail because: You are the assignee for the bug.