FPGAwars / icestudio

:snowflake: Visual editor for open FPGA boards
https://icestudio.io
GNU General Public License v2.0
1.72k stars 246 forks source link

Support for upduino 2.1? #397

Closed wgaylord closed 4 years ago

wgaylord commented 4 years ago

The current nightly build (Because I need the support for pre-installed python3.8) supports upduino 1 and 2. I have a upduino 2.1 I have tried to use the upduino 2 setting but icestudio can not detect it.

How would I go about adding support for this minor version change?

Obijuan commented 4 years ago

As the upduino 2.1 is already supported by Apio, it should be straightforward in icestudio. I've added and experimental support, but as I do not have that board, I cannot test it.

Please, verify the information in the files in the folder: icestudio/app/resources/boards/upduino21. I've copied the files from the upduino 2.0, but I do not know if the .pcf is the same. It would be great if you could check it

For testing, you have use the development version (develop branch). Start icestudio and check the menu board: the upduino 2.1 should be there

wgaylord commented 4 years ago

I am going to have to wait for the nightly build. Trying to install from github emits errors due to npm being unable to unlink files.

Obijuan commented 4 years ago

It would be really nice if you can make it works. Waiting for the next build could take some time. So, let's first fix this problem: making you able to execute icestudio development version

For executing icestudio from the repo you need to install node 10.17.0 (this is important). Then you have to execute the commands:

Thanks a lot for your help

wgaylord commented 4 years ago

Ah might be because I have the latest LTS (12.something) node installed.

I am on windows btw.

Trying again with 10.17.0 installed.

wgaylord commented 4 years ago

Okay while testing I can't flash to it. icestudio reports an error as "Unknown Board" Is there a debugging logger I can enable?

I think it might not be using the latest of the APIO. Is there a way I can make sure it installs from github instead of PyPi?

Obijuan commented 4 years ago

Let's check your version. Open icestudio dev and go to Tools/Toolchains:

screenshot

The latest version is Apio 0.5.3b0

If you are not using the latest version, click on Tools/Toolchain/update

Then select the upduino 2.1 board from Select/Board

screenshot2

You should see tha new board on the bottom right

screenshot3

Open a "Hello world" example and try to upload

Clicking on the View/Command Output you can see a log of what happended

wgaylord commented 4 years ago

Hm Okay had to run the update.

Not sure what might be the problem. The PCF looks correct based off the information in the board's design repo.

[Fri Apr 10 11:23:11 2020] Processing upduino21

yosys -p "synth_ice40 -json hardware.json" -q main.v nextpnr-ice40 --up5k --package sg48 --json hardware.json --asc hardware.asc --pcf main.pcf -q ERROR: package does not have a pin named '0' (on line 3) ERROR: Loading PCF failed. 0 warnings, 2 errors scons: *** [hardware.asc] Error -1 ========================= [ ERROR ] Took 1.82 seconds =========================

Obijuan commented 4 years ago

I am trying to reproduce the error

You have updated the toolchain... can you tell me the version that appears in your tool/toolchain option? It should be 0.5.4 (the latest), but maybe there is another bug preventing it to update (i have to check that)

Obijuan commented 4 years ago

OK. I think were is the problem. The support for the upduino 2.1 was added in Apio 0.5.4. But, due to a bug (i have to check), the Toolchain update is not working fine (At least in my computer. That is what I want you to tell me the version that has been installed when clicking on update)

wgaylord commented 4 years ago

I have 0.5.4 now. It seems to be working now. (Was able to upload a constant lighting of an led) Thank you. I am going to try out some of the examples.

Obijuan commented 4 years ago

Great!!! :-)

Did you install it manually? or by using the icestudio tool/update option? I will leave this issue open until this bug was confirmed and fixed

wgaylord commented 4 years ago

Just using the update option. I am having an issue trying to get stuff that requires a clock signal to work but that might just be that I don't know how to use icestudio yet.

EDIT: Trying to just make the led change with a pin. (Push button example) I get this error.

[Fri Apr 10 12:39:01 2020] Processing upduino21

yosys -p "synth_ice40 -json hardware.json" -q main.v nextpnr-ice40 --up5k --package sg48 --json hardware.json --asc hardware.asc --pcf main.pcf -q ERROR: expected PCF syntax 'set_io cell pin' (on line 4) ERROR: Loading PCF failed. 0 warnings, 2 errors scons: *** [hardware.asc] Error -1 ========================= [ ERROR ] Took 1.41 seconds =========================

Guessing there is something else that needs work to make upduino 2.1 work properly.

Obijuan commented 4 years ago

OK, I've fixed the problem with de update. Please, could you execute again Tool/Toolchain/UPdate?

Then, make sure the apio version is 0.5.4:

screenshot_6

I want to make sure that the update was working ok, and that both icestudios, mine and yours, are equal. Then I will test some example for the upduino to reproduce your errors

Obijuan commented 4 years ago

OK, The synthesis is working ok for me (i cannot upload because I do not have the board)

I am sending three examples. Use the option Tools/Builds to synthesize. send here the output of the View/Command Output option

test-upduino.zip

wgaylord commented 4 years ago

https://gist.github.com/wgaylord/a98abb120176bc3fe01a8c41bc01e881

All of them built and uploaded. They also all works. (First one had the LED off because they use negative logic https://github.com/tinyvision-ai-inc/UPduino-v2.1/blob/master/RTL/src/upduino.pdc#L2)

Must just be me doing something wrong. Guess i have a lot to learn.

Obijuan commented 4 years ago

Great! So i will close this issue as the upduino 2.1 is now supported in icestudio-dev

Thanks you very much for your help 🙂

wgaylord commented 4 years ago

Our welcome. Glad to help! Just need to figure out how to do simple stuff. (Like using T-Flip Flops and the such in this.) Is there any good tutorials that involve icestudio?

Obijuan commented 4 years ago

I've written a very basic tutorial, but it is in Spanish :-( I still did not have the time to translate into English:

You can also check the Jedi Collection for Icestudio, with lots of blocks. It is also in spanish mainly and the blocks has been tested in the Alhambra II board. But maybe it could help

ertgtct commented 4 years ago

https://gist.github.com/wgaylord/a98abb120176bc3fe01a8c41bc01e881

All of them built and uploaded. They also all works. (First one had the LED off because they use negative logic https://github.com/tinyvision-ai-inc/UPduino-v2.1/blob/master/RTL/src/upduino.pdc#L2)

Must just be me doing something wrong. Guess i have a lot to learn.

You should not drive the RGB LED directly on the Board. Here is a good tutorial https://blog.idorobots.org/entries/upduino-fpga-tutorial.html (it is for the UPduio v2.0, but should also work here). You can implement the driver in an extra code Block, or you can use a premade Block with the driver implemented (attached to this post RGBdriver.zip ).