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

Add basic support for JTAG over FTDI in bitbang mode #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mon
Copy link

@mon mon commented Aug 12, 2022

This does make some small architectural changes to the pif layer, but I hope it's acceptable.

Assorted notes

  • Tested working on an MSP430F249
  • FT232R with known broken clock takes ~40 seconds to program a 4.6k binary
  • FT4232H takes ~26 seconds
  • TI's MSP-FET takes 3 seconds
  • Zadig must be used on Windows to replace the device driver with WinUSB, but this is pretty standard for FTDI bitbang applications
  • Added some things to the README that tripped me up (libusb 0.1 had me confused for hours because msys provides its own usb.h by default)
  • I don't even know if my new jtbitbang_set_fast_baud function is required, but the mehfet driver used it and it seemed like it was needed

Further work will be to look into MPSSE for the FT4232H to increase speed more. The mspdebug backend seems inefficient (though reliable), especially since every state change, even those that can reasonably be batched, needs to written out over USB. I tried batching all writes unless TCK or RST was strobed, but it broke device identification - I suspect there's some early step that requires pin toggles to be synchronous.

Programming in general on the MSP430 architecture seems hugely inefficient. Each word takes over 16 bytes of instructions over the wire. I have yet to verify this, but I suspect the MSP-FET might upload a small bit of assembly to locally program data from RAM, then use the auto-incrementing RAM load feature to program the data in chunks.

@mon
Copy link
Author

mon commented Feb 14, 2023

As an extra note - I have an alternate branch, ftdi-bitbang-dev that implements all of the above optimisations.

  • Writes are batched, and reads are only performed when necessary
  • Programming code gets pushed to the device to greatly improve speed and remove 350KHz flash clock requirement
  • The D2XX driver installed by windows update is attempted to be loaded and used if available (Zadig no longer required, still GPL compatible)

With these changes, programming time is on the order of 2 seconds.
However, I'm not making a PR for it

  • It's only tested on the devices I use (MSP430F24[7|9|10])
  • It assumes you have a crystal installed for generating the flash clock on-chip
  • It probably doesn't work for MSP430X

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

Successfully merging this pull request may close these issues.

1 participant