greatscottgadgets / apollo

microcontroller-based FPGA / JTAG programmer
BSD 3-Clause "New" or "Revised" License
63 stars 30 forks source link

Firmware assumes JTAG in RESET state in `jtag_init()` #29

Open mossmann opened 1 year ago

mossmann commented 1 year ago

jtag_init() in jtag_tap.c uses jtag_set_current_state(STATE_TEST_LOGIC_RESET) which sets the microcontroller's understanding of the state to Test-Logic-Reset without actually ensuring that the FPGA's JTAG TAP is in that state. This is worked around by calling jtag_go_to_state(STATE_TEST_LOGIC_RESET) immediately after calling jtag_init() (which is done from the host side with vendor request REQUEST_JTAG_GO_TO_STATE after REQUEST_JTAG_START) every time JTAG is initialized.

This is arguably a bug, but it needs further investigation and test.