修改probe-rs以支持FT4232

 · 1 分钟

我用的板子: https://github.com/arm8686/FT4232HL-Board

添加对应的vid:pid

这样程序才能识别调试器

参考 https://github.com/probe-rs/probe-rs/pull/485

修改程序所使用的通道

因为我的板子主要引出了BDBUS作为JTAG接口,所以需要调整下

原本默认是A,改成B,在 probe-rs/src/probe/ftdi/mod.rs:45附近

diff --git a/probe-rs/src/probe/ftdi/mod.rs b/probe-rs/src/probe/ftdi/mod.rs
index b549694..f400b1c 100644
--- a/probe-rs/src/probe/ftdi/mod.rs
+++ b/probe-rs/src/probe/ftdi/mod.rs
@@ -42,7 +42,12 @@ pub struct JtagAdapter {
 impl JtagAdapter {
     pub fn open(vid: u16, pid: u16) -> Result<Self, ftdi::Error> {
         let mut builder = ftdi::Builder::new();
-        builder.set_interface(ftdi::Interface::A)?;
+        if pid == 0x6011 {
+            builder.set_interface(ftdi::Interface::B)?;
+        }
+        else {
+            builder.set_interface(ftdi::Interface::A)?;
+        }
         let device = builder.usb_open(vid, pid)?;

         Ok(Self {

其它问题

还有些玄学问题,不知道如何解决