Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which USB<->JTAG interface is the easiest/best/preferred to implement? #418

Open
harbaum opened this issue Jan 18, 2024 · 3 comments
Open

Comments

@harbaum
Copy link

harbaum commented Jan 18, 2024

I am working with the Tang Nano 20k. This doesn't use a real ft2232 but instead runs some emulation of the ft2232 on a bl616 risc-v CPU. Now this chip is pretty powerful and i'd like to use it for other purposes as well. So I need to replace its firmware which can easily be done. The Tang Nano 20k even has the "Update" button for this purpose. But doing so makes the board loose its ability to load the FPGA.

Sipeed (the maker of the Tang Nano 20k) will not allow to distribute the source code of the ft2232 emulation, so it's not possible to include this functionality into some custom extended firmware for the Tang Nano 20k. One solution is to restore the original firmware whenever the FPGA (or its flash) is to be updated and then flash the custom firmware again afterwards. This works but is a pain to use ...

What I am now searching for is a replacement solution for the FPGA-loader part inside the BL616 MCU on the Tang Nano 20k. I don't like the ft2232 emulation that much as it re-uses the FTDI USB vendor ID and potentially violates FTDIs rights.

So here's my question: What is the USB/JTAG protocol that you guys think is the one to implement? There is e.g. a CDC ACM example for the BL616 CPU and all the JTAG pins are also accessible. But I'd need something in between these two parts. Which protocol should one implement on top of CDC ACM (or anything else, but CDC ACM seems to be a good choice) to be able to use openFPGAloader to upload code to the Tang Nano 20k?

I am doing this under Linux. But if openFPGAloader would use CDC ACM (as opposed to libusb directly), then this should imho work nicely under other OSs as well without the need to use tools like Zadig under Windows oder give special libusb permissions under Linux.

For context: I am using this in my MiSTeryNano project (https://github.com/harbaum/MiSTeryNano). This implements an Atari ST in the FPGA and I am currently running support functions (USB host for keyboard and mice, file system handling for the SD card etc) on a seperate BL616 MCU. But I'd like to use the on-board MCU instead.

@harbaum harbaum changed the title Which USB<->JTAG interface is the easiest/best/preferrred to implement? Which USB<->JTAG interface is the easiest/best/preferred to implement? Jan 18, 2024
@trabucayre
Copy link
Owner

CDC ACM is for emulate serial interface no?
My first idea is dirtyJTAG but this protocol is slower than ftdi.

@harbaum
Copy link
Author

harbaum commented Jan 18, 2024

Yes, CDC ACM emulates a serial interface. The advantage is that it's a USB standard protocol and doesn't need any special drivers. It'll give you a COM port under windows and a /dev/ttyACM under Linux. And MacOS also has a standard way to deal with it.

Speed is imho no issue.

@harbaum
Copy link
Author

harbaum commented Jan 18, 2024

DirtyJTAG is a vendor class device and also seems to use a custom protocol on USB side and would require libusb (and zadig on windows) etc. While this is not a no-go I think it would be more end-user friendly to use something that runs over a regular COM/tty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants