Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error while updating bootloader: invalid literal for int() with base 10 #18

Closed
shenki opened this issue Aug 1, 2018 · 5 comments
Closed

Comments

@shenki
Copy link

shenki commented Aug 1, 2018

I have installed tinyprog 2058597 using python setup.py install --user, an was using it to update the bootloader my TinyFPGA BX:

$ tinyprog --update-bootloader

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Only one board with active bootloader, using it.

    The following update:

        New Version: 1.0.1
        Notes: Updates USB VID:PID to fix issues with APIO not recognizing the board.

    is available for this board:

        /dev/ttyACM0: TinyFPGA BX 1.0.0
            UUID:
            FPGA: ice40lp8k-cm81

    Would you like to perform the update? [y/N] y
    Fetching stage one...
    Programming stage one...
    Erasing: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 163kB/s]
    Writing: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 177kB/s]
    Reading: 100%|████████████████████████████████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 425kB/s]
    ...Success!
    Waiting for stage one to reconnect....connected!
    Fetching stage two...
    Programming stage two...
    Erasing:   0%|                                                                                                   | 0.00/299k [00:00<?, ?B/s]
Traceback (most recent call last):
  File "/home/joel/.local/bin/tinyprog", line 11, in <module>
    load_entry_point('tinyprog==1.0.18', 'console_scripts', 'tinyprog')()
  File "build/bdist.linux-x86_64/egg/tinyprog/__main__.py", line 282, in main
  File "build/bdist.linux-x86_64/egg/tinyprog/__main__.py", line 152, in perform_bootloader_update
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 419, in program_bitstream
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 375, in program
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 347, in erase
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 301, in _erase
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 290, in wait_while_busy
  File "build/bdist.linux-x86_64/egg/tinyprog/__init__.py", line 21, in to_int
ValueError: invalid literal for int() with base 10: ''
@ewenmcneill
Copy link
Contributor

For the benefit of anyone else finding this, @shenki also posted on the TinyFPGA Discourse forum, and got this suggestion on how it might be possible to fix with a soldering iron and/or a SPI flash programmer:

https://discourse.tinyfpga.com/t/error-while-updating-bootloader-invalid-literal-for-int-with-base-10/484/3

(See also #43 for another user with similar symptoms.)

Ewen

@paulo-raca
Copy link

I had exactly the same problem (Twice! I bricked my 2 boards 🤦‍♂️ )

I'll try the arduino programmer, but is there anything in finding the reason/fixing the bug?

@ewenmcneill
Copy link
Contributor

@paulo-raca Sorry to hear that you had the same problem. Hope you're able to recover them (there are a few suggestions on the TinyFPGA forum for various ways to reflash the initial bootloader externally).

I don't think anyone has figured out exactly what causes the problems (to me it feels like a timing race between the tinyprog serial software, the TinyFPGA bootloader verilog, and the SPI flash chip used). There's a couple of attempts at working around it (eg, these pull requests that haven't been merged -- #52, #16), but my one (#52) didn't seem to be sufficient to fix everything by itself and the other one earlier one (#16) contains lots of other things so it's not clear it'll ever get merged.

So far the best work around seems to be:

Unfortunately the original TinyFPGA developer seems to have had no time to do anything with this in the last year (all the more recent commits are others, often written or merged by Tim (mithro) who is also busy). So it's not clear the underlying cause will ever be debugged fully. But perhaps it'll eventually be possible to get enough workarounds (eg, all three of the above) merged, and a new full release made (there's only been dev releases in the last year, which have to be explicitly installed).

(It'd also help if the TinyFPGA boards shipped with the newest bootloader on them, but manufacturing/delivery pipelines tend to be relatively long, so I'm not sure if a new batch has been made in the last year....)

Ewen

@mithro
Copy link
Collaborator

mithro commented Jul 6, 2019

I believe this has been fixed now?

@ewenmcneill Is that your understanding?

@mithro mithro closed this as completed Jul 6, 2019
@ewenmcneill
Copy link
Contributor

I believe this has been fixed now?
@ewenmcneill Is that your understanding?

It is hopefully less likely to occur now with #52 (and the symptoms will have changed if it does, as the invalid literal for int() was in the error handling code which has been patched separately already). I suspect we probably need #55 as well for a more complete solution (and/or someone debugging how the state machine gets stuck -- it feels like a race to me).

But yes, at this stage it seems useful to consolidate down to one open issue for the "bootloader reprogramming timed out" problem.

Ewen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants