-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
valentyusb serial #347
base: master
Are you sure you want to change the base?
valentyusb serial #347
Conversation
FTR, stnolting/neorv32#102. |
I tried this out, to get usb_hello to build, I had to simlink https://libre-soc.org/irclog/%23libre-soc.2022-03-03.log.html I didn't get it to work fully: commands I ran: (cd usb_hello; ln -s ../hello_world/head.S .; make)
sudo make FPGA_TARGET=ORANGE-CRAB-0.21 dfuprog DOCKER=1 RAM_INIT_FILE=usb_hello/usb_hello.hex MEMORY_SIZE=$((1<<18)) Also, why is |
also, it would probably be useful to have the button reset only microwatt if pressed for a short interval, but also reset the usb interface if pressed for a longer interval, that way you can catch whatever microwatt tries to do immediately after reset, but before the host sets up the usb device. |
Signed-off-by: Matt Johnston <[email protected]>
An extra uart is added at 0xc0008000 attached to valentyusb, using the OrangeCrab's onboard USB port. This has a liteuart interface, an identifier bit is added to syscon. Generated from branch hw_cdc_eptri of https://github.com/litex-hub/valentyusb The generate script is based on valentyusb/sim/generate_verilog.py UARTUSB: usbserial@8000 { device_type = "serial"; compatible = "litex,liteuart"; reg = <0x8000 0x100>; interrupts = <0x15 0x1>; }; (requires extra kernel patches for early console at present v5.16) Signed-off-by: Matt Johnston <[email protected]>
usb_hello is a copy of hello_world but uses both consoles Signed-off-by: Matt Johnston <[email protected]>
That makes it easier to override a non-litedram build for testing RAM_INIT_FILE, eg make microwatt.dfu LITEDRAM_GHDL_ARG=-gUSE_LITEDRAM=false RAM_INIT_FILE=usb_hello/usb_hello.hex Signed-off-by: Matt Johnston <[email protected]>
Ah, it's because by default it builds litedram which doesn't use
The usb tx on the microwatt side will wait for a host to be attached to the usb serial terminal, so it isn't critical to connect straight away. At some point that would need fixing though. I've also added head.S and rebased to master branch, seems fine in quick testing (4cf2921 had some changes). I've removed usb_hello.elf. (unrelated - when I tried a latest docker build, routing was taking hours. Perhaps a recent toolchain update is problematic, an older oss-cad-suite 20220118 is OK here) |
tested...it works for me now! hopefully I can figure out how to get it to work with litedram though, since I want to try to boot linux at some point, and the fpga's memory is likely too small for that |
It will work OK with litedram, just the default litedram init code is using console.c functions which write to uart0 not the usb uart. If you modify console.c so that it calls Upstream Linux already has a liteuart serial driver, you can enable it in the devicetree with
The branch https://github.com/mkj/linux/commits/matt/orangecrab also has a liteuart driver for powerpc early boot. mkj/linux@9b3975d - not necessary but is useful to see what's going on. |
I added a simple 3D maze game that is a pretty impressive demo of what Microwatt can do. It's based on antonblanchard#347 Signed-off-by: Jacob Lifshay <[email protected]>
It's a pity this doesn't just have a standard 16550 register interface. That would make the software side so much easier. |
any progress? |
This adds valentyusb as a uart, works for orangecrab though should be applicable to other platforms.
I'm leaving this as a draft pull request because the software side needs a bit of tidying up - usb_hello is a bit of a demo, really console.c should switch similarly to potato?
It isn't 100% reliable, I have sometimes had the Linux system lock up, yet to debug.
Note that the UART TX will wait forever until a USB host starts reading the USB tty - just "cat /dev/ttyUSBS0" may not be reliable enough and the board will seem to get stuck (
screen /dev/ttyUSBS0
works OK).An early kernel liteuart driver is in mkj/linux@9b3975d