google / CFU-Playground

Want a faster ML processor? Do it yourself! -- A framework for playing with custom opcodes to accelerate TensorFlow Lite for Microcontrollers (TFLM). . . . . . Online tutorial: https://google.github.io/CFU-Playground/ For reference docs, see the link below.
http://cfu-playground.rtfd.io/
Apache License 2.0
470 stars 120 forks source link

/dev/ttyUSB0 hangs during load #813

Closed SHIBSIE closed 8 months ago

SHIBSIE commented 8 months ago

I am working on a Nexys Video board, i've tried multiple boards that kept facing issues, however I got my hands on this board and I am trying to run a simple template on it to check that everything works. Unfortunately, it just hangs and i do not get the menu. If anyone can help me understand what the problem is please.

I am getting the following: /home/shibli/CFU-Playground/soc/bin/litex_term --speed 1843200 --kernel /home/shibli/CFU-Playground/proj/proj_template_v/build/software.bin /dev/ttyUSB0

tcal-x commented 8 months ago

Hi @SHIBSIE , Fortunately I have that board! I will see if I can reproduce the issue.

tcal-x commented 8 months ago

This board is different than most in that it seems to have two separate USB / FTDI paths, one for programming and the other for UART. On boards such as Arty, the same path is used for both.

I'm still working through it myself, and don't yet have the answer for CFU Playground. But when directly building a LiteX SoC for the board, using just a LiteX installation not CFU Playground, I found that I need to connect the cable to the PROG connector to configure the FPGA, then change the cable to connect to UART to talk to the BIOS running on the FPGA. It works either by changing a single cable, or by having both connected using a hub (or using multiple USB ports on your computer). However, when both are connected, you will see both e.g. /dev/ttyUSB0 and /dev/ttyUSB1 --- you might need to try both to find the one that is being used as UART.

But, assuming you had the cable just connected to PROG, that would explain why you see no response when trying to connect.

Later I will try to see if I can get CFU Playground to work.

SHIBSIE commented 8 months ago

Hello @tcal-x , thank you for your help. I have figured that out during my tests, but still no change. I have tried both ports and tried using a single cable and both, but still ddidnt work. I also checked to see if it is something that has to do with UART speed, but still nothing.

tcal-x commented 8 months ago

One thing I found that I need to do is after the attempted connect using litex_term, press the CPU_RESET button on the board (NOT the PROG button). Then I see the LiteX boot banner, and then the CFU Playground menu.

Maybe that is all that is necessary. I was trying some other things, and this is what I got to work:

make TARGET=digilent_nexys_video UART_SPEED=115200 TTY=/dev/ttyUSB0  prog load

(and press the CPU_RESET button)

This does set a slower UART speed; I'm not sure if that's needed.

Also, there's a chance you'll need to change it to /dev/ttyUSB1 or even something else.

tcal-x commented 8 months ago

I did get this to also work (with faster UART speed) (and pressing the CPU_RESET button):

make TARGET=digilent_nexys_video UART_SPEED=921600 TTY=/dev/ttyUSB0 prog load

But when I tried with the default speed (even higher), I got garbled text.

SHIBSIE commented 8 months ago

I have tried this but unfortunately it also did not work. I was able to borrow an Arty A7 board to test with and it worked perfectly, it means the problem was not with my environment as I have suspected. Might be something with the board I don't really know. For now I am going to stick with the Arty.

Thank you for you help, really appreciated.