Recognizing TinyFPGA BX in WSL


#1

Does the TinyFGPA BX work in the Windows Subsystem for Linux (WSL?) Using tinyprog from DOS commandline, and the tinyFPGA works fine. But for me - it is not found in WSL.

I believe at one point that I was able to use the TinyFPGA in WSL, but it no longer seems to be recognized. There’s mention of using icestorm in WSL here, but it does not explicitly mention the programming of the BX from WSL (I suppose I could use icestorm in WSL, and program from DOS)

I opened this GitHub issue with all of the details, mistakenly thinking that I had used the BX as a USB device (apparently it can be either).


#2

Well, all I can tell you is that I have Anaconda installed and then under WSL I did:

pip install --user tinyprog

However, I was only able to access it via the DOS tinyprog.exe

when I do a β€˜which tinyprog.exe’ it shows up here

{anaconda root}/Scripts/tinyprog.exe

For example, under WSL I have done the following:

tinyprog.exe --com COMnn -p hardware.bin firmware.bin


#3

yes, this works for me in Windows DOS prompt:

tinyprog --com COM15 --list

returning a list of tinyFPGA boards:

TinyProg CLI
------------
Using device id 1d50:6130
Boards with active bootloaders:

    COM15: TinyFPGA BX 1.0.0
        UUID: (my ID, omitted)
        FPGA: ice40lp8k-cm81

however in WSL, these commands:

tinyprog --com COM15 --list

tinyprog --com /dev/ttyS14 --list

tinyprog --com /dev/ttyS15 --list

all return the same result:

TinyProg CLI
------------
Using device id 1d50:6130
Boards with active bootloaders:
    No active bootloaders found.  Check USB connections
    and press reset button to activate bootloader.

for me, which tinyprog.exe results in:

/mnt/c/Users/gojimmypi/AppData/Local/Programs/Python/Python36/Scripts/tinyprog.exe

…and the first thing that comes to mind is whether tinyprog should be using python 2.7 or 3.6?


#4

The symptoms look like the computer detection in the bootloader is not working, so the bootloader warm boots to the user image.

Possible solutions are to press reset just before executing the tinyprog command or try a USB hub.

The very first time you use the BX, you won’t get this problem as the user image is the bootloader, so it warm boots to another copy of itself.


#5

I tried the USB hub trick… Windows detects a β€œnew” device an installs drivers for it:

tinyFPGA BX continues to be recognized in DOS just fine, but not in WSL (on the same machine)

I also tried pressing reset just before running tinyprog, no change. WSL still reports No port was specified and no active bootloaders found while DOS finds the device every time,.

Just to confirm @lawrie.griffiths - you are able to see your BX from a WSL prompt?


#6

I don’t use WSL. I use either native Windows or native Linux.

But others have reported that when using a VM on windows they have to press reset to go into the bootloader - see Noob: boot from flash on TinyFPGA-bx. Perhaps you have to keep the button pressed.

And the USB hub worked for some people - [Solved but don't know why] Bootloader/USB strange behavior, so I thought it was worth a try.

Yours may be a different problem.


#7

I have installed WSL with Ubuntu and am getting the same as you. It is not a bootloader issue as I can see from the breathing LED that the bootloader is running. So it looks like an issue with access to the USB device. I will investigate.


#8

Well I can make -b work:

lawrie@MSI:~$ tinyprog -b -c /dev/ttyS5

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Booting /dev/ttyS5

#9

And -p seem to work:

lawrie@MSI:~$ tinyprog -c /dev/ttyS5 -p hardware.bin

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Programming /dev/ttyS5 with hardware.bin
    Programming at addr 028000
    Waking up SPI flash
    135100 bytes to program
    Programming and Verifying: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 135k/135k [00:03<00:00, 39.9kB/s]
    Success!

but -m does not work:

lawrie@MSI:~$ tinyprog -m -c /dev/ttyS5
[]
lawrie@MSI:~$

and nor does -l.

I probably had to do:

sudo chmod 666 /dev/ttyS5


#10

wow. you rock. Thanks for installing WSL just for this exercise; That’s very kind. I’m glad you confirmed that neither of these commands work for you:

tinyprog  --com /dev/ttyS12 --list
tinyprog  --com /dev/ttyS12 --meta

for me… as those didn’t work, I didn’t even try others. But yes - I can confirm the -b DOES WORK! :smile:

0 $ tinyprog -b -c /dev/ttyS12

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Booting /dev/ttyS12

and I can confirm the -b is doing what it is supposed to, as the SOS Hello World demo is apparently still on the device, and gets loaded & runs with the -b option.

I plugged the device into a different USB port, and it worked without changing permissions. So I’m not sure the sudo chmod 666 /dev/ttySnn is actually required.

I have a hard time believing this problem is with the BX itself, as I’m pretty sure I had this working in WSL not long ago. I’d like to open a new WSL GitHub issue - but ha! I don’t think anyone would believe me, lol. Perhaps Luke can take a better look at this and determine conclusively if the problem is with his bootloader, or with the WSL serial drivers.

fwiw - none of these work, no device is found:

gojimmypi@MYHOST : /mnt/c/Windows/System32
0 $ tinyprog -b

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    No port was specified and no active bootloaders found.
    Activate bootloader by pressing the reset button.
gojimmypi@MYHOST : /mnt/c/Windows/System32
1 $ tinyprog -m
[]
gojimmypi@MYHOST : /mnt/c/Windows/System32
0 $ tinyprog -l

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    No port was specified and no active bootloaders found.
    Activate bootloader by pressing the reset button.
gojimmypi@MYHOST : /mnt/c/Windows/System32
1 $ tinyprog --pyserial

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    No port was specified and no active bootloaders found.
    Activate bootloader by pressing the reset button.

I was also unable to get any sequence of pressing or holding the reset button to make any difference in WSL.

Most importantly: the -p works:

0 $ tinyprog  --com /dev/ttyS12 -p hello_word.bin

    TinyProg CLI
    ------------
    Using device id 1d50:6130
    Programming /dev/ttyS12 with hello_word.bin
    Programming at addr 028000
    Waking up SPI flash
    135100 bytes to program
    Programming and Verifying: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 135k/135k [00:03<00:00, 34.1kB/s]
    Success!

thank you very much for your help.

btw: I have a blog on this topic here.


#11

I had been thinking of trying WSL for a while so I could do Linux stuff on my Windows laptop, so your problem gave me the incentive to do it.