You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tinyprog is crashing when running apio upload command:
(venv) [tinyfpga-vhdl/clock_div4] (main) $ apio upload
Info: use custom SConstruct file
[Sun Aug 11 17:31:31 2024] Processing TinyFPGA-BX
---------------------------------------------------------------------------------------------------------------------------------------------------
tinyprog --pyserial -c /dev/ttyACM0 --program hardware.bin
TinyProg CLI
------------
Using device id 1d50:6130
Programming /dev/ttyACM0 with hardware.bin
Programming at addr 028000
Waking up SPI flash
135100 bytes to program
Erasing: 0%| | 0.00/135k [00:00<?, ?B/s]
Erasing: 0%| | 0.00/135k [00:01<?, ?B/s]
Traceback (most recent call last):
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 19, in to_int
return ord(value)
^^^^^^^^^^
TypeError: ord() expected a character, but string of length 0 found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/rowan/workspace/vhdl/venv/bin/tinyprog", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__main__.py", line 346, in main
if not fpga.program_bitstream(addr, bitstream):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 419, in program_bitstream
return self.program(addr, bitstream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 375, in program
self.erase(addr, len(data), disable_progress=False)
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 347, in erase
self._erase(addr, erase_length)
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 301, in _erase
self.wait_while_busy()
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 290, in wait_while_busy
while to_int(self.read_sts()) & 1:
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/rowan/workspace/vhdl/venv/lib/python3.12/site-packages/tinyprog/__init__.py", line 21, in to_int
return int(value)
^^^^^^^^^^
ValueError: invalid literal for int() with base 10: b''
scons: *** [upload] Error 1
=========================================================== [ ERROR ] Took 1.38 seconds ===========================================================
I debugged the error, and found that the issue was calling to_int on the result of self.read_sts() in the wait_while_busy() method. I was able to resolve this so I could program my board by modifying the to_int function to catch the ValueError raised when int is called on an empty bytes object, and return 0 in that case. I.e.:
tinyprog is crashing when running
apio upload
command:I debugged the error, and found that the issue was calling
to_int
on the result ofself.read_sts()
in thewait_while_busy()
method. I was able to resolve this so I could program my board by modifying theto_int
function to catch theValueError
raised whenint
is called on an empty bytes object, and return 0 in that case. I.e.:I am guessing this is something to do with a change in pyserial? maybe older versions didn't return empty bytes object when nothing was read?
I am using apio on linux
The text was updated successfully, but these errors were encountered: