eblot / pyftdi

FTDI device driver written in pure Python
Other
509 stars 212 forks source link

Invalid TMS length error when JtagEngine.go_idle() issues when already idle #331

Open tgbotsford opened 1 year ago

tgbotsford commented 1 year ago

It seems the state machine transition doesn't handle the case of being in idle and getting go_idle command. I've added workaround in my code to check for current state before issuing a JtagEngine.go_idle() command.

Traceback (most recent call last):
  File "./cli.py", line 234, in <module>
    main()
  File "./cli.py", line 226, in main
    sel_ft4232(ft4232_list, usb_tree)
  File "./cli.py", line 55, in sel_ft4232
    direct_ft4232_cli(ft_sn)
  File "lib/lib_tc1_jtag.py", line 332, in direct_ft4232_cli
    jtag.go_idle(chnl)
  File "lib/lib_tc1_jtag.py", line 55, in go_idle
    jtag.go_idle()
  File "/usr/local/lib/python3.7/dist-packages/pyftdi/jtag.py", line 499, in go_idle
    self.change_state('run_test_idle')
  File "/usr/local/lib/python3.7/dist-packages/pyftdi/jtag.py", line 493, in change_state
    self._ctrl.write_tms(events)
  File "/usr/local/lib/python3.7/dist-packages/pyftdi/jtag.py", line 252, in write_tms
    raise JtagError('Invalid TMS length')
pyftdi.jtag.JtagError: Invalid TMS length