<whitequark[m]>
Degi: some configuration of openocd is necessary
<lkcl>
Degi: we just set up a page which documents this, i have a FT232 here and wired it up to C4M-JTAG
<lkcl>
slightly different but we researched the source code of openocd directly
<lkcl>
there are "default" patterns (RX->TDI etc. etc. something like that) which if you obey *exactly* that configuration you do not have to change anything in openocd.cfg
<lkcl>
disconnecting the 3.3v-5.0V jumper entirely is CRITICALLY IMPORTANT
<lkcl>
do not under ANY CIRCUMSTANCES try to have the power from the FPGA supplied *to* the FT232 at the same time as connecting the jumper which also supplies power from an on-board regulator
<lkcl>
you absolutely must let the *FPGA* provide the VREF (Voltage Ref) *to* the FT232 so that the FT232 knows what the CMOS levels are
<lkcl>
do not be tempted - at all - to think "oh the FPGA supplies 3.3v, the FT232 on-board regulator supplies 3.3v, therefore what's the big deal?"
<lkcl>
the Big Deal is: one will be 3.31v (fluctuating), the other will be 3.20v (fluctuating) and you get a current fight between the two
<lkcl>
one or both will lose that fight, and the Magic Smoke Genie will leave either (or both) devices
<lkcl>
btw if you need to do something that's so low-level you don't even have a "target" (no pre-defined CPU as specified in openocd's configs), you can use something like this:
<lkcl>
that's setting the interface to ft232, then the baud rate to 5khz (because i have 12 in dangling wires with no GND ribbon cable in between each signal)
<lkcl>
then i have C4M JTAG set up with an ir width of 4, etc. etc.
<lkcl>
it's a pretty basic bare-bones config.
Degi_ has joined #nmigen
Degi has quit [Ping timeout: 252 seconds]
Degi_ is now known as Degi
_whitenotifier-3 has joined #nmigen
<_whitenotifier-3>
[YoWASP/yosys] whitequark pushed 1 commit to develop [+0/-0/±1] https://git.io/JO69h
chiastre has quit [Remote host closed the connection]
chiastre has joined #nmigen
<Degi>
lkcl: Neat, so I can just use a FT232H chip with that? I don't intend to use an adapter but the chip itself on a custom PCB, so the chip doesn't need to be specially configured to do JTAG but rather OpenOCD will do that for me? (For example on the ECP5 EVN board the FT2232 chip is connected to an EEPROM, I wondered what that is for)
<Degi>
Oh, is that an FT232R? That can do JTAG?
<Degi>
Yes, that looks good... So OpenOCD directly drives the GPIO and doesnt need any extra configuration...
<hell__>
not sure if R variants can do JTAG (they do not support USB 2.0, which may be a bottleneck)
<agg>
the ft232h is the usual choice i believe, then openocd doesn't need to wiggle gpio directly, the chip understands jtag (and spi and uart) natively
<lkcl>
Degi: they do UART and they can be put into direct bit-banging mode (general purpose)
<agg>
or 2232h, then you can have a usb-uart and usb-jtag at the same time
<lkcl>
agg: neat!
<agg>
(or usb-fifo and usb-jtag, which can be nice if you want a higher bandwidth pipe out of an fpga)
<lkcl>
agg: i got a DTD Tech FT232R off of amazon, it was dirt-cheap, arrived in like a day :)
<Degi>
Hm yes, then maybe the 2232h is the best choice. So it doesn't need any configuration apart from OpenOCD for the MPSSE?
<agg>
for mpsse, looks like no, though an eeprom would let you customise the VID/PID and product strings
<agg>
for the sake of a small cheap eeprom i'd probably fit it anyway
<agg>
assuming that's what you mean by "any configuration" - the chip doesn't have any non-volatile memory built-in, so you often connect the eeprom to allow permanent configuration
<agg>
(mpsse is what you need for jtag)
<hell__>
the H variants can also be used as a SPI programmer with flashrom :-)
<Degi>
Oh neat, so when I connect some pins to the SPI flash it can program it too?
<agg>
yea, the 2232 has two interfaces, and each can be jtag or spi or uart or parallel FIFO to an fpga
<agg>
if you don't include an eeprom they both default to uart and can be reconfigured to spi or jtag at runtime
<agg>
eeprom also lets you store a serial number usb string which is handy for programming the right board if you ever have two ftdi chips plugged in at once, heh
<agg>
what fpga are you using? some like ecp5 can pass-through spi flash to jtag, so you only need jtag connected
<Degi>
Yes I want to use the ECP5 but AFAIK OpenOCD doesn't support that (yet)
<agg>
huh, i would have thought it did
<agg>
i don't use openocd so not sure
<Degi>
At least somebody told me it didn't
<agg>
openocd did just get a new release after like 3 years, for the longest time you had to build from source to get anything at all recent
<Degi>
oh
<agg>
anyway doesn't matter, if you're using ecp5 you can forego openocd and save yourself a load of pain
<agg>
which handles both loading bitstreams directly, and writing them to spi flash through the ecp5
<Degi>
Oh that is very practical
<agg>
or if you don't especially like ftdi (like me) i wrote https://github.com/adamgreig/ecpdap which can use any cmsis-dap debug probe to do the same thing (direct load or spi flash)
<agg>
but if you just want a chip to solder to your pcb without much fuss, probably the ft2232h is an easier choice
<agg>
sorry for dumping a ton of text, i remember it being a bit overwhelming when i was first looking into "how so how do i load bitstreams..."
<Degi>
Yes I was too, maybe this should be documented somewhere well
<Degi>
Thanks though!
<agg>
i definitely recommend ecpprog instead of openocd for a plain ft232h->ecp5->spi flash setup, though, much simpler and easier
<Degi>
So ecpdap can program the FPGA itself and program the flash separately? That sounds fine, maybe I'll just get a CMSIS-DAP probe, at least thats much cheaper than putting a FT2232H on every PCB
pftbest has quit [Remote host closed the connection]
pftbest has joined #nmigen
<agg>
that's my strategy, i use the ARM 10-pin 0.05" debug connector that's common for SWD/JTAG, and then all my probes plug right in
<Degi>
Nvm the FT2232H isnt available anywhere anyways
<agg>
if you're making a development board it's sometimes nice to have the programming built-in, and sometimes you need a usb-uart or usb-fifo built in too, so it ends up being convenient to use the ftdi chip
<agg>
lol of course
<Degi>
Eh, I'll just use external UART, I guess worst case you can attach one to PMOD
<agg>
wow yea looks like they're sold out across the board