"Error: board TinyFPGA-BX not connected" [SOLVED]


#21

So, on my board, this works until i unplug and replug. Then it has to be done all over again. Is there a way to make changes that are permanent? Also i get some errors after a success.

blink_project>pip install --upgrade --no-cache-dir “tinyprog>=1.0.9”
Requirement already up-to-date: tinyprog>=1.0.9 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (1.0.9)
Requirement not upgraded as not directly required: packaging in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (17.1)
Requirement not upgraded as not directly required: tqdm<5,>=4.19.5 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (4.23.4)
Requirement not upgraded as not directly required: six in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (1.11.0)
Requirement not upgraded as not directly required: jsonmerge<2,>=1.4.0 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (1.5.1)
Requirement not upgraded as not directly required: intelhex<3,>=2.2.1 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (2.2.1)
Requirement not upgraded as not directly required: pyserial<4,>=3 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from tinyprog>=1.0.9) (3.4)
Requirement not upgraded as not directly required: pyparsing>=2.0.2 in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from packaging->tinyprog>=1.0.9) (2.2.0)
Requirement not upgraded as not directly required: jsonschema in c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages (from jsonmerge<2,>=1.4.0->tinyprog>=1.0.9) (2.6.0)

Windows 10 – all current versions of apio and atom etc.


#22

sorry output is this…

blink_project>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:

    COM3: TinyFPGA BX 1.0.0
        UUID: f55e9edd-ba84-4bc7-89cf-3a1b4187d0a2
        FPGA: ice40lp8k-cm81

Would you like to perform the update? [y/N]

y
Fetching stage one…
Programming stage one…
Erasing: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:01<00:00, 133kB/s]
Writing: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 143kB/s]
Reading: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 187kB/s]
Traceback (most recent call last):
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\Tinkerer\AppData\Local\Programs\Python\Python36-32\Scripts\tinyprog.exe_main
.py", line 9, in
File "c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_main
.py", line 275, in main
perform_bootloader_update(port)
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_main_.py”, line 128, in perform_bootloader_update
p.boot()
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_init_.py”, line 316, in boot
self.ser.write(b"\x00")
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\serial\serialwin32.py”, line 323, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout


#23

I have this same error. Through Atom with APIO, upload fails with writeTimeoutError.

At command line, tinyprog -p <hardware.bin> also fails for writeTimeoutError. But in this case, I get the “SOS” LED (cleared on power cycle)

Win10, following the user guide.

In both cases, the device disconnects to USB when the error occurs.


#24

Ok, thanks for the information, this really helps me to understand the problem. I’ll have a fix for the bootloader update feature later tonight.


#25

@jaycosper, @qibble.jm: I wanted to update you so you know what the problem is, and what the solution will be when I release it shortly.

The problem: After tinyprog erases, writes, and verifies what it programmed to SPI flash, it will command the bootloader to reboot into the user program. The reboot command is a single byte. In your case, the board is rebooting before it sends a USB ACK packet back to your computer. Even though the board received and executed the command successfully, the computer doesn’t know this. Because it doesn’t receive successful acknowledgement that the data was transferred, the write times out.

The solution: Specifically for the reboot command, gracefully handle and ignore the write timeout. This will allow stage two of the bootloader update to proceed.

I’ll be pushing the update to GitHub and PyPI shortly.


#26

@jaycosper, @qibble.jm: I fixed the issue you ran into along with another race condition that @robertbaruch ran into on his recent live-stream.

Give it a try and let me know how it goes.

pip install --upgrade --no-cache-dir  "tinyprog>=1.0.10"
tinyprog --update-bootloader

#27

Hmmm… my bootloader looks old and doesn’t get flagged for upgrade:

tinyprog -l

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

    COM4: TinyFPGA BX 1.0.0
        UUID: 75e4e04a-1666-4789-b276-8309fa2d09ed
        FPGA: ice40lp8k-cm81

tinyprog --update-bootloader

TinyProg CLI
------------
Using device id 1d50:6130
Only one board with active bootloader, using it.
All connected and active boards are up to date!

Is this correct? I am using tinyprog 1.0.10.


#28

The version number you see in tinyprog -l is the hardware version of the board. I can see why it’s confusing. I’ll make an update that explicitly shows the bootloader version number as well.

In your case, if tinyprog --update bootloader says you are up to date, then you are up to date. :slight_smile:


#29

OK I understand.

I am still getting errors when trying to upload a design. The design gets loaded correctly, but the device disconnects from USB and throws this exception. Happens in both Atom and command line flows.
tinyprog -p hardware.bin

TinyProg CLI
------------
Using device id 1d50:6130
Only one board with active bootloader, using it.
Programming COM4 with hardware.bin
Programming at addr 028000
Waking up SPI flash
135100 bytes to program
Erasing: 100%|█████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 184kB/s]
Writing: 100%|█████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 173kB/s]
Reading: 100%|█████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 375kB/s]
Success!

Traceback (most recent call last):
File “c:\users\jay\appdata\local\programs\python\python36\lib\site-packages\tinyprog_init_.py”, line 318, in boot
self.ser.write(b"\x00")
File “c:\users\jay\appdata\local\programs\python\python36\lib\site-packages\serial\serialwin32.py”, line 323, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:\users\jay\appdata\local\programs\python\python36\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\users\jay\appdata\local\programs\python\python36\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\jay\AppData\Local\Programs\Python\Python36\Scripts\tinyprog.exe_main
.py", line 9, in
File "c:\users\jay\appdata\local\programs\python\python36\lib\site-packages\tinyprog_main
.py", line 342, in main
fpga.boot()
File “c:\users\jay\appdata\local\programs\python\python36\lib\site-packages\tinyprog_init_.py”, line 320, in boot
except writeTimeoutError:
TypeError: catching classes that do not inherit from BaseException is not allowed


#30

This specific error was fixed in tinyprog version 1.0.10. Give it a try:

pip install --upgrade tinyprog

#31

Ah! Thank you fro pointing that out. For anyone who is still paranoid until an update to the tool comes out, tinyprog -m spits out the bootloader information as well as the board information.


#32

I am using 1.0.10.
pip install --upgrade tinyprog
Requirement already up-to-date: tinyprog in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (1.0.10)
Requirement not upgraded as not directly required: jsonmerge<2,>=1.4.0 in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (1.5.1)
Requirement not upgraded as not directly required: packaging in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (17.1)
Requirement not upgraded as not directly required: intelhex<3,>=2.2.1 in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (2.2.1)
Requirement not upgraded as not directly required: tqdm<5,>=4.19.5 in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (4.23.4)
Requirement not upgraded as not directly required: pyserial<4,>=3 in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (3.4)
Requirement not upgraded as not directly required: six in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from tinyprog) (1.11.0)
Requirement not upgraded as not directly required: jsonschema in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from jsonmerge<2,>=1.4.0->tinyprog) (2.6.0)
Requirement not upgraded as not directly required: pyparsing>=2.0.2 in c:\users\jay\appdata\local\programs\python\python36\lib\site-packages (from packaging->tinyprog) (2.2.0)

tinyprog -m
[
{
“boardmeta”: {
“name”: “TinyFPGA BX”,
“fpga”: “ice40lp8k-cm81”,
“hver”: “1.0.0”,
“uuid”: “75e4e04a-1666-4789-b276-8309fa2d09ed”
},
“bootmeta”: {
“bootloader”: “TinyFPGA USB Bootloader”,
“bver”: “1.0.1”,
“update”: “https://tinyfpga.com/update/tinyfpga-bx”,
“addrmap”: {
“bootloader”: “0x000a0-0x28000”,
“userimage”: “0x28000-0x50000”,
“userdata”: “0x50000-0x100000”
}
},
“port”: “COM4”
}
]


#33

Same problem here FWIW: one of my boards uploads fine, the other always throws this error on upload (but works).

(In addition, if I upload from IceStorm, I get a “USB Device Not Recognized” error on Windows 10 after the board is automatically restarted with the uploaded code. This does NOT occur on Atom. Perhaps this is a separate issue, or a quirk of IceStorm (which may be trying to re-enumerate the device at that point)).


#34

Thanks for the info. None of the boards I’ve tried here have exhibited this behavior…let me try some more experiments to see if I can reproduce it in code. I know what’s happening, but my fix didn’t work due to a quirk in pyserial.writeTimeoutError.


#35

this info might help some…

c:\blink_project>apio upload
[Sun Jul 15 19:02:52 2018] Processing TinyFPGA-BX

tinyprog -c COM4 --program hardware.bin

TinyProg CLI

Using device id 1d50:6130
Programming COM4 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: 24%|##4 | 32.8k/135k [00:00<00:00, 135kB/s]
Erasing: 73%|#######2 | 98.3k/135k [00:00<00:00, 135kB/s]
Erasing: 97%|#########7| 131k/135k [00:00<00:00, 136kB/s]
Erasing: 100%|##########| 135k/135k [00:01<00:00, 134kB/s]

Writing: 0%| | 0.00/135k [00:00<?, ?B/s]
Writing: 14%|#4 | 19.2k/135k [00:00<00:00, 176kB/s]
Writing: 29%|##9 | 39.7k/135k [00:00<00:00, 179kB/s]
Writing: 45%|####4 | 60.2k/135k [00:00<00:00, 181kB/s]
Writing: 60%|#####9 | 80.6k/135k [00:00<00:00, 183kB/s]
Writing: 75%|#######5 | 101k/135k [00:00<00:00, 185kB/s]
Writing: 88%|########8 | 120k/135k [00:00<00:00, 179kB/s]
Writing: 100%|##########| 135k/135k [00:00<00:00, 184kB/s]

Reading: 0%| | 0.00/135k [00:00<?, ?B/s]
Reading: 15%|#5 | 20.7k/135k [00:00<00:00, 189kB/s]
Reading: 33%|###2 | 44.1k/135k [00:00<00:00, 196kB/s]
Reading: 50%|##### | 68.1k/135k [00:00<00:00, 202kB/s]
Reading: 67%|######6 | 90.3k/135k [00:00<00:00, 202kB/s]
Success!
Reading: 84%|########4 | 114k/135k [00:00<00:00, 203kB/s]
Reading: 100%|##########| 135k/135k [00:00<00:00, 209kB/s]
Traceback (most recent call last):
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_init_.py”, line 318, in boot
self.ser.write(b"\x00")
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\serial\serialwin32.py”, line 323, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\Tinkerer\AppData\Local\Programs\Python\Python36-32\Scripts\tinyprog.exe_main
.py", line 9, in
File "c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_main
.py", line 342, in main
fpga.boot()
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_init_.py”, line 320, in boot
except writeTimeoutError:
TypeError: catching classes that do not inherit from BaseException is not allowed
scons: *** [upload] Error 1
============================================= [ ERROR ] Took 10.17 seconds =============================================

also this…

c:\blink_project\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:

    COM3: TinyFPGA BX 1.0.0
        UUID: f55e9edd-ba84-4bc7-89cf-3a1b4187d0a2
        FPGA: ice40lp8k-cm81

Would you like to perform the update? [y/N] y
Fetching stage one...
Programming stage one...
Erasing: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:01<00:00, 131kB/s]
Writing: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 184kB/s]
Reading: 100%|███████████████████████████████████████████████████████████████████| 135k/135k [00:00<00:00, 211kB/s]

Traceback (most recent call last):
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_init_.py”, line 318, in boot
self.ser.write(b"\x00")
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\serial\serialwin32.py”, line 323, in write
raise writeTimeoutError
serial.serialutil.SerialTimeoutException: Write timeout

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 193, in run_module_as_main
main”, mod_spec)
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\runpy.py”, line 85, in run_code
exec(code, run_globals)
File "C:\Users\Tinkerer\AppData\Local\Programs\Python\Python36-32\Scripts\tinyprog.exe_main
.py", line 9, in
File "c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_main
.py", line 287, in main
perform_bootloader_update(port)
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_main_.py”, line 129, in perform_bootloader_update
p.boot()
File “c:\users\tinkerer\appdata\local\programs\python\python36-32\lib\site-packages\tinyprog_init_.py”, line 320, in boot
except writeTimeoutError:
TypeError: catching classes that do not inherit from BaseException is not allowed


#36

Excellent! Thanks you!


#37

Ok @qibble.jm, @jaycosper, @MartyMacGyver:

Please test tinyprog version 1.0.11 for me and let me know if it takes care of the Python error after programming.

pip install --upgrade --no-cache-dir "tinyprog>=1.0.11"

#38

On the board that works, it still works.

On the board with the issue, it actually worked right once, but otherwise is still having the same issue.

Note that bver isn’t changing after this bootloader is installed.


#39

If you’re still seeing the error, please paste it here. It is unlikely to be exactly the same.


#40

I don’t expect the bootloader version to change. The bootloader versions are exactly the same, but the USB VID:PID is getting updated.