mrjimenez / JTAG

JTAG library for Arduino
BSD 2-Clause "Simplified" License
124 stars 22 forks source link

Problem when trying to Upload a XSVF #9

Open Snocksman opened 2 years ago

Snocksman commented 2 years ago

Hi !

I have uploaded the sketch to my Arduino nano, connected it to an ATF1504AS and tried to Upload a XSVF File to it with the Python scripts.

I enter this Command to Upload the file:

python xsvf -p /dev/ttyUSB0 FE3Test.xsvf

And here is the Error Message, that I get when trying to Upload the XSVF File:

snocksman@raspberrypi:~/JTAG/extras/python $ python xsvf -p /dev/ttyUSB0 FE3Test.xsvf
Traceback (most recent call last):
  File "/home/snocksman/JTAG/extras/python/xsvf", line 57, in <module>
    main()
  File "/home/snocksman/JTAG/extras/python/xsvf", line 46, in main
    u.upload_all_files(args.fileName)
  File "/home/snocksman/JTAG/extras/python/Uploader.py", line 150, in upload_all_files
    ok = self.upload_one_file(fd)
  File "/home/snocksman/JTAG/extras/python/Uploader.py", line 144, in upload_one_file
    line.translate(Uploader._translate_str))
TypeError: a bytes-like object is required, not 'str'

What can I do to get it running...?

mrjimenez commented 2 years ago

Hi Snocksman,

I suspect this error is due to using Python 3 instead of Python 2, can you confirm my suspicion?

mrjimenez commented 2 years ago

Also, try to run idcode_simpler.xsvf first. This should return the ID of your device and should work in any device supporting an ID code.

Snocksman commented 2 years ago

Hi ! When trying to use python2.7 I get the following error message regardless what I am trying to Upload:

Traceback (most recent call last):
  File "xsvf", line 8, in <module>
    import Uploader
  File "/home/snocksman/jtag/JTAG/extras/python/Uploader.py", line 113
    (bytes_written, self._file_size - bytes_written), end='')
                                                         ^
SyntaxError: invalid syntax

When trying to upload something with python 3.x, the arduino LEDs are blinking before the error message, with this new error when using Python 2.7 the LEDs stay off.

I get the same message, when i simply prompt: python xsvf

Snocksman commented 2 years ago

Hey, I got it running !!!

I have to use Python 2.7 and cut a little part of the code in Line 113 of the file Uploader.py: (bytes_written, self._file_size - bytes_written), end='') Here I had to remove the ,end=''

After that I was able to Upload the idcode_simpler.xsvf and it returned the Chip ID.

One Problem is left: When I try to Upload my code to the Chip I get the following error:

('IMPORTANT:', 'DR check failed!')
('IMPORTANT:', '*****************************')
('IMPORTANT:', 'Failure at instruction # 2865')
('IMPORTANT:', '*****************************')
('IMPORTANT:', 'Last TDO: 3F FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF/166 bits')
('IMPORTANT:', 'Processed 2865 instructions.')
('IMPORTANT:', 'Checksum:  0x85/24070.')
('IMPORTANT:', 'Sum: 0x000DEC7B/24070.')
Quit: DR check failed (-101).
  Expected checksum:  0x7B/46948.
  Expected sum: 0x000DFF85/46948.
Elapsed time: 10.00 seconds.
mrjimenez commented 2 years ago

It is strange that it has processed so many instructions and has produced an error .

There is a debug mode, which you can activate by setting DEBUG to 1 in SerialComm.h. The output should get very verbose, but you might get a clue of what is failing. I have tried to comply as much as possible to the Xilinx specification, but sometimes the xsvf compilier might generate code that the arduino xsvf player can't handle.

Snocksman commented 2 years ago

It´s a problem with the xsvf file. The SVF-File seems to be ok, but the converted XSVF-File is buggy. (P.S.: I wrote you an E-Mail to your sourceforge account)