icestudio icon indicating copy to clipboard operation
icestudio copied to clipboard

Unable to upload to TinyFPGA BX on macOS

Open Bexin3 opened this issue 1 year ago • 45 comments

Hello, I tried to upload a totally basic schematic with one input one output and some others, but I keep getting an error. With all other boards it just says the board isn't connected, but with BX I get the following error; I tried using both the 0.9.5 and 0.9.6 toolchains but the result is the same. Info: No apio.ini file Info: No apio.ini file [Mon Jun 24 10:14:47 2024] Processing TinyFPGA-BX

tinyprog --libusb --program hardware.bin Traceback (most recent call last): File "/Users/redacted/.icestudio/venv/bin/tinyprog", line 8, in sys.exit(main()) File "/Users/redacted/.icestudio/venv/lib/python3.9/site-packages/tinyprog/main.py", line 249, in main active_boards = get_ports(device) + get_ports("1209:2100") File "/Users/redacted/.icestudio/venv/lib/python3.9/site-packages/tinyprog/init.py", line 39, in get_ports for d in usb.core.find(idVendor=vid, idProduct=pid, find_all=True) File "/Users/redacted/.icestudio/venv/lib/python3.9/site-packages/usb/core.py", line 1309, in find raise NoBackendError('No backend available') usb.core.NoBackendError: No backend available scons: *** [upload] Error 1

Bexin3 avatar Jun 24 '24 09:06 Bexin3

I tried file in https://groups.google.com/g/fpga-wars-explorando-el-lado-libre/c/hbWVxvIWU_E/m/V2itMDZpAAAJ?pli=1 but no luck

Bexin3 avatar Jun 24 '24 09:06 Bexin3

For further information this happens no matter if the board is connected and I press the button or even if its fully disconnected

Bexin3 avatar Jun 24 '24 09:06 Bexin3

hi! when do you buy your board? the month and year is important to check what firmware is in it.

your machine is intel or arm based?

cavearr avatar Jun 24 '24 15:06 cavearr

hi! when do you buy your board? the month and year is important to check what firmware is in it.

your machine is intel or arm based?

Hello, the machine is arm based. In terms of when it was in October of 2023 so one of the new batches.

Bexin3 avatar Jun 24 '24 15:06 Bexin3

Thanks , could you help me to try to fix it? my tiny is prior to this and works fine, if you could give me feedback , we could find a solution.

You tried the last _init.py in the thread? (you mention it, but i don't understand if you overwrite with the last init.py) https://groups.google.com/g/fpga-wars-explorando-el-lado-libre/c/hbWVxvIWU_E/m/V2itMDZpAAAJ?utm_medium=email&utm_source=footer

cavearr avatar Jun 24 '24 15:06 cavearr

Thanks , could you help me to try to fix it? my tiny is prior to this and works fine, if you could give me feedback , we could find a solution.

You tried the last _init.py in the thread? (you mention it, but i don't understand if you overwrite with the last init.py) https://groups.google.com/g/fpga-wars-explorando-el-lado-libre/c/hbWVxvIWU_E/m/V2itMDZpAAAJ?utm_medium=email&utm_source=footer

Ofcourse, I'd be willing to help, I can't help with coding much but I can try to test anything if you have any ideas. Yes I have tried it but unfortunately it didn't work and had no effect overall.

Bexin3 avatar Jun 24 '24 15:06 Bexin3

Ok! give me some time to prepare the new fix and tell you to try it.

cavearr avatar Jun 24 '24 16:06 cavearr

Hi @Bexin3 !

Ill put you three files here https://mega.nz/folder/jM9DlZhQ#7f9N9uniTnS3MHvS5mF3HQ

  • page1.txt and page2.txt are the missing metada in your fpgatiny.
  • tinyprog a patched version of tinyprog for osx arm -test-tiny.bin a blinking light test if you dont have a test bitstream.

remember first do in your shell:

chmod 755 tinyprog

i need you do this steps in a shell to know if it works:

tinyprog --atb --security page1.txt -a 2 tinyprog --atb --security page2.txt -a 3

And then try to upload some bitstream:

tinyprog --atb -p hardware.bin

hardware.bin is your test bitstream

Tell me if it works!

cavearr avatar Jul 02 '24 16:07 cavearr

Hi @Bexin3 !

Ill put you three files here https://mega.nz/folder/jM9DlZhQ#7f9N9uniTnS3MHvS5mF3HQ

  • page1.txt and page2.txt are the missing metada in your fpgatiny.
  • tinyprog a patched version of tinyprog for osx arm -test-tiny.bin a blinking light test if you dont have a test bitstream.

remember first do in your shell:

chmod 755 tinyprog

i need you do this steps in a shell to know if it works:

tinyprog --atb --security page1.txt -a 2 tinyprog --atb --security page2.txt -a 3

And then try to upload some bitstream:

tinyprog --atb -p hardware.bin

hardware.bin is your test bitstream

Tell me if it works!

Hello, so far no luck. Not sure if I am doing this correctly but I downloaded the folder, changed to the folder, ran the first command. Then trying to run the second it said zsh: command not found: tinyprog, so I instead tried to run it as ./tinyprog, in which case it seems to just run the executable and it doesn't change, and neither after running these order does the outcome, saying TinyProg CLI ------------ Using device id 1d50:6130 No port was specified and no active bootloaders found. Activate bootloader by pressing the reset button. Which to clarify I did press the button

Bexin3 avatar Jul 03 '24 09:07 Bexin3

Sorry maybe i write you very fast XD

Do this steps in order:

  1. Downdload de folder content
  2. Enter in it
  3. chmod 755 tinyprog
  4. Connect your tinyfpga
  5. ./tinyprog --atb --security page1.txt -a 2
  6. ./tinyprog --atb --security page2.txt -a 3
  7. ./tinyprog --atb -p hardware.bin

If you send me the output of the 4) 5) and 6) steps , i'm very gratefully.

cavearr avatar Jul 03 '24 15:07 cavearr

Outputs are as follows; 5) TinyProg CLI ------------ Using device id 1d50:6130 No port was specified and no active bootloaders found. Activate bootloader by pressing the reset button. 6) TinyProg CLI ------------ Using device id 1d50:6130 No port was specified and no active bootloaders found. Activate bootloader by pressing the reset button. 7) TinyProg CLI ------------ Using device id 1d50:6130 No port was specified and no active bootloaders found. Activate bootloader by pressing the reset button.

Bexin3 avatar Jul 03 '24 20:07 Bexin3

Have you brew installed? if not install it ( https://brew.sh/ ) and then execute the next two commands:

brew install libusb ln -s /opt/homebrew/lib ~/lib

When this was done, execute again your first test :

./tinyprog --libusb --program hardware.bin

try first with the original tinyprog and if not works try with the patched.

cavearr avatar Jul 03 '24 20:07 cavearr

Have you brew installed? if not install it ( https://brew.sh/ ) and then execute the next two commands:

brew install libusb ln -s /opt/homebrew/lib ~/lib

When this was done, execute again your first test :

./tinyprog --libusb --program hardware.bin

try first with the original tinyprog and if not works try with the patched.

I did have both installed, I reinstalled it but no luck, both original and new still have the same output.

Bexin3 avatar Jul 03 '24 20:07 Bexin3

had you did the command ?:

` ln -s /opt/homebrew/lib ~/lib

`

cavearr avatar Jul 03 '24 20:07 cavearr

had you did the command ?:

` ln -s /opt/homebrew/lib ~/lib

`

Yeah, no difference

Bexin3 avatar Jul 03 '24 20:07 Bexin3

Coud be obvious but you have pyusb installed?

pip install pyusb

cavearr avatar Jul 03 '24 20:07 cavearr

And if the previous not work try the next command before executing tinyprog:

export DYLD_LIBRARY_PATH="/opt/homebrew/lib:$DYLD_LIBRARY_PATH"

cavearr avatar Jul 03 '24 20:07 cavearr

Coud be obvious but you have pyusb installed?

pip install pyusb

Not sure if I had it tbh, to be clear I installed the toolchain through the app and didn't do any terminal installations before now so may lack something else if there are other requirements. I tried it and with the export thing but the behaviour didnt change

Bexin3 avatar Jul 03 '24 21:07 Bexin3

with the tiny connected , could you do lsusb and send me the output?

cavearr avatar Jul 03 '24 21:07 cavearr

with the tiny connected , could you do lsusb and send me the output?

Bus 000 Device 001: ID 1d6b:XHCI XHCI XHCI Linux Foundation USB 3.1 Bus

Bexin3 avatar Jul 03 '24 21:07 Bexin3

I get the same thing when the board is not connected though weird

Bexin3 avatar Jul 03 '24 21:07 Bexin3

Looks like system report doesn't see it either weird

Bexin3 avatar Jul 03 '24 21:07 Bexin3

Looking at TinyFPGA page looks like multiple people are reporting issues with the new batch with no response from the developer..

Bexin3 avatar Jul 03 '24 21:07 Bexin3

Yes for this, i'm asking you about the date of your buy.

I think you have some problems. The first one is your system not detect the board (this is until tinyprog works).

lsusb should detect the board first. I thinkt some test, tell you soon.

cavearr avatar Jul 04 '24 04:07 cavearr

Yes for this, i'm asking you about the date of your buy.

I think you have some problems. The first one is your system not detect the board (this is until tinyprog works).

lsusb should detect the board first. I thinkt some test, tell you soon.

Good news, after cutting of a pin of the voltage regulator the board is now detected, will have a look if your programs work now

Bexin3 avatar Jul 04 '24 08:07 Bexin3

Sadly your program still doesn't upload, but lsusb now gives the following output; Bus 002 Device 001: ID 1d50:6130 1d50 Communication Device Bus 000 Device 000: ID 1d50:6130 1d50 USB 3.1 Bus

Further I wanted to note an interesting behavior the LED is blinking even before I press the button

Bexin3 avatar Jul 04 '24 08:07 Bexin3

The cut of the pin is some solution that you view in some place?

The original and patched have the same output?

cavearr avatar Jul 04 '24 09:07 cavearr

The cut of the pin is some solution that you view in some place?

The original and patched have the same output?

Yeah the cut pin is from a thread where it turns out the voltage regulator on the new batch was wrongly placed and produced 5V instead of 3.3v which is why the computer woudlnt detect the board and I had no output. Now I have the output from the lsusb as what I sent detecting the board though I still can't upload to it; I can't test the original output as I don't have one but the ID seems to be correct

Bexin3 avatar Jul 04 '24 09:07 Bexin3

i'm refering if you try the original tinyprog and patched

cavearr avatar Jul 04 '24 10:07 cavearr

i'm refering if you try the original tinyprog and patched

Ahh, both of them have the same output sadly

Bexin3 avatar Jul 04 '24 10:07 Bexin3