-
Notifications
You must be signed in to change notification settings - Fork 201
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
SDRAM controller for the ULX3S #169
Comments
See #105. |
That looks interesting! I am also searching for a small SDRAM controller to tinker with one of my board's memories. Maybe I will give it a try. From a first look, the interface seems to be pretty straightforward, so it shouldn't be a big deal to connect it to the processor's external bus interface.
👍 We can help with the processor's bus interface, but for questions regarding the SDRAM controller you might be be better off contacting @nullobject. |
Thanks @umarcor ! |
Hello again @stnolting and @umarcor! I got some improvement regarding the SDRAM. I got in touch with the ULX3S guys, first I got a Verilog 8-bit controller from one of their project (I select that because came with really interesting test support) and translate to VHDL. Because I had some doubts about how to make it works, I ask them, and after we make it work the owner of the project offer me to adapt the test to work with https://github.com/nullobject/sdram-fpga, that is 32-bit controller and will be better choice for integrate in NeoRV32! On the way they had to fix some defects detected when we pass the test to the Nullobject controller, but now seams working! |
@zipotron, note that you can use Verilog sources together with NEORV32, through GHDL + Yosys. See example MixedLanguage for FOMU (https://github.com/stnolting/neorv32/tree/master/setups/osflow/board_tops) which is based on https://github.com/im-tomu/fomu-workshop/tree/master/hdl/mixed/blink. See https://github.com/stnolting/neorv32/blob/master/setups/osflow/Makefile#L92-L97. You should be able to create a WithSDRAM target by copying that snippet. Nevertheless, I believe it is interesting to have the controller available in VHDL as well. I recommend channel https://gitter.im/vhdl/General for questions related to the language. |
Hi @umarcor , yes, I know, thanks for the info but as you can see, the exposed code have the controller in VHDL and the test in Verilog, and this is the part of the job I did. I put an effort in provide VHDL controller for follow the style, and for other reason more egoist, I am good Verilog coder, but just beginner in VHDL, and this kind of task give me the excuse for study it. |
These are great news!
I will have a look. You source code also looks good - at least the code itself 😉 |
Oh, I misunderstood. I thought the whole controller was in Verilog and you were converting it to VHDL. So, do you want to keep doing mixed-language simulation (keep the test in Verilog) or do you want to provide a complete solution in VHDL? In the latter case, authors of open source verification frameworks (https://larsasplund.github.io/github-facts/) such as OSVVM, VUnit or cocotb do participate in https://gitter.im/vhdl/General. So, you can head there not only for questions related to the language, but to ask about the functionality you want to achieve and what are the alternatives. BTW, you can alt+click on a gitter message, and you'll get a direct link to it, instead of a link to the channel. |
@stnolting Well, I can help for one chip, the unique I have, that is in my ULX3S, but as soon as we have one, modify for work with others would be easy. As soon as my work allows me I will start to connect the controller with the Wishbone, and lets see! |
Last thing, well, still early for ask this, but, I would like to have something for test the external RAM, like small program as a bootloader that play with leds if the memory is writable/readable...Anyone have already anything? |
If you have a UART ( |
@stnolting This is perfect! |
Hello @stnolting , I am trying to execute the "Hex_viewer" in the ULX3S, I need a bit of support. I compiled the "Hex_viewer" going to the "neorv32/sw/example/hex_viewer" directory and executing "make install", It compiled OK and generated a .vhd in the "RTL" directory, then I went back to the root project directory and did "make -C setups/osflow BOARD=ULX3S MinimalBoot" and flash the .bit to the board. The first led blinks few second as expected and after that keep lighting. I connect the UART using Putty with 19200 speed, Putty report "connected, but dont shows any message, and I can not write command. But the board seams listening, if I type "echo -ne '\033[2J' > /dev/ttyUSB0" the UART led of the board blinks... Did I miss anything setting up the HEX_VIEWER? |
Hey @zipotron !
This is the bootloader status LED. If I remember correctly, the ULX3S board has a status LED connected to the USB-chip's TX pin, so you should see that flashing while the boatloader is transmitting it's console. |
@stnolting , Thanks a lot! Last question before start working on it and I will not bother you for a while! Where can I find examples and doc about uploading exe using the bootloader? Thanks!!! |
No worries - questions are always welcome! 👍
|
@stnolting sorry, I promise no more question for a while but... I configured in my Linux the Putty as is specified in the doc, connect but dont shows nothing, when you type anything the TX UART led in the board blinks, the the board is responding... I reboot in Windows and install TeraTerm as the doc suggests... the same, I tried also with MobaXTerm, the same. |
Hmm strange... If you reset the processor and just type The ULX example setup if configured for 25MHz:
|
Btw, which version of the processor are you using? edit |
@stnolting I just did a pull, and now the "hart" led is not blinking anymore and Putty don't connect... |
You are still using the plain, unmodified ULX3S setup from this repository, right?
If your terminal program does not connect there is a problem on your computer side. All the USB handling is done by the on-board FTDI chip and is not effected by the FPGA bitstream. |
If you mean last version of master branch, yes.
Make sense, but before the pull (was 3 days old code) was at least connecting and the (gpio0) led blinking, also, at that time I was trying with Windows also connecting but not showing text. And now nothing... I don't know what to think. Any suggestion @stnolting ? |
I do not think this is a bitstream issue. However, you could use the "last stable" version and try that: https://github.com/stnolting/neorv32/releases/tag/v1.6.2 Do you generate the bitstream by yourself or do you use the one from the project's implementation workflow? Can you synthesize a setup just connecting rxd_input to txd_output (local UART echo)? This is the simplest way to check the UART connection is working. |
Hi @stnolting
Yes, I always synthesize locally.
I remember doing this when we were working in ULX3S and AlhambraII ports, actually was the verification way at that time, I never saw the UART interface in non of my boards, At that time I understood that was the verification way because something was pending to be implemented until see the UART interface.
Yes! I will try that! Also I will try luck to ask the ULX3S team if someone from their side can check also! |
You could try a bitstream from the Implementation workflow (for example the latest one: https://github.com/stnolting/neorv32/actions/runs/1378356656)
👍 |
@stnolting , we have a problem, the same behavior, no blinking (gpio) led anymore and no UART connection. And I insist, before was blinking and connecting (just was not showing the bootloader menu). something changed in the last few day and break the ULX3S |
@stnolting I investigated |
That's interesting! Maybe I broke something updating the bootloader... The changes your are pointing at make use of the memory information from the SYSINFO module to setup the stack pointer: so basically, the bootloader's stack pointer setup is now "done" via the setting of the
Do you get the bootloader console via UART when using this version? |
Could you please re-run your synthesis using this Maybe I screwed up the setup of the "global pointer"... I'm doing some more tests... |
Forget about my previous comment 😅 |
@stnolting Hi! Sorry, during the week I just can be in this for few time at night... I tested!
I just tried, and I got: Also I saw that you did a commit! I am going I try that...
|
Great to see the bootloader connection is working again! 👍
This error means there is a problem accessing the SPI flash (see 📚 Data Sheet: Bootloader Error Codes). Were you trying to boot from flash (bootloader command
This means your executable is too big for the processor's IMEM. The default ULX3S setup implements 4kB of IMEM while the plain
Another option would be to enable the compressed instructions ISA extension (set
This is really really bad! 😅 However, the bootloader should not terrify the user with some cryptic exception code here - it should just output |
I just checked the ULX3S' FPGA datasheet - the Lattice ECP5 LFE5U-85 has plenty of block RAM (3744 kbit!!!) 🎉 How about a PR to upgrade the ULS3S setup's memory configuration? We could (should!) use the default memory configuration (i.e. 16kB IMEM, 8kB DMEM) so there is no need to adapt the default linker script when compiling executables for the board. Just an idea (nice-to-have!) for a future setups: edit |
Hi! Yes... as soon as I have a functional NeoRV32 in my ULX3S is will push the controller (that is already prepared and tested!) |
Umm, you mean a PR with the right memory configuration for execute the bootloader! Sure! As soon as I can jump on it! |
Adding an SDRAM controller to the board setup is something for the near future. I was talking about some processor-internal updates. Just change the setup to use 16kB of instruction memory (IMEM) and 8kB of data memory (DMEM) instead of the current 4kB/8kB configuration. This setup also allows to use the project's software framework as-is (no modifications of the linker script required). I can take care of that PR - basically, it is just changing two lines of code. edit Regarding the SDRAM controller:
|
@stnolting you are fast! I am sorry, during the week I can not dedicate almost no time... But Saturday I will, I could see that you discard the first option because started with the Wishbone! Or shall we integrate directly in the core? Is just to know the strategy.
What do you mean with locally? |
No worries! Take your time.
The PR (#189) is just something like a proof-of-concept. It adds an unconnected Wishbone bus to the setup that can be used by the user to attach custom modules - like your memory interface.
In the current state of that PR, you could download it an add the SDRAM controller locally on your machine without the SDRAM ctrl being explicitly added to the example setup in this repository. I don't know if it is better to provide just a "Wishbone-ready" setup (which is the current state of #189) or to directly add the SDRAM controller to that setup. This is open for discussion 😉 |
@stnolting I am testing!
No, didn't press any key to get that, and I am still getting the same in the master branch:
Even I tried to increase the memory to 32kb, the same, and if I override the image "neorv32_bootloader_image.vhd" the error still
I checkout the branch "ulx3s_add_wishbone" and I couldn't synthesize using "make -C setups/osflow BOARD=ULX3S MinimalBoot" |
Let's stay on the master branch at first.
Does this appear right after resetting the processor?
Can you post the whole bootloader output? Especially the hardware information it prints at the beginning. |
Sorry, I have overseen that. |
Just after the "hart" led stop blinking
That is the whole output!!! Just this 3 lines:
|
Ah ok, I see. This behavior is normal. After reset, the bootloader waits 8s for a user input. If there is no user input the bootloader starts the autoboot sequence and tries to fetch an executable via SPI from an external flash. Since there is no SPI module implemented in your design, you get this error: Can you upload an execute programs using the bootloader? To test this, please compile the Connect to your FPGA board via UART, reset the processor and wait for the bootloader to show up. Hit any key to skip the autoboot sequence, then press edit
That's all?? Even after resetting the processor again? There should be something like this:
|
Ouch! I am so sorry, I was expecting the menu pop-up after the led stop blinking! Yes, was working! I just try to push "H" key before the led stop blinking and is working! really sorry for make you work around for no reason, my fault. I just compile the Blink_led app and I am going a restart in Windows for uploading it! BTW, do you know any way to upload app from Linux? |
👍 Can you upload and execute the
I only use graphical programs for Windows. On Linux I am just using the shell to interact with the UART's tty device. Not pretty, but handy 😉 |
Blink_led app works!
Sure, I am going a try to do in Linux using the shell... OK! Works! |
Btw, we should continue the discussion regarding the Wishbone interface in #189 |
@zipotron I am from the dark side, and I wrote a basic SDRAM controller for ULX3S in January. It is neither wishbone nor VHDL, but it is intended for teaching and well commented. You may use it for guidance: https://github.com/BrunoLevy/learn-fpga/blob/master/FemtoRV/RTL/SDRAM/muchtoremember.v |
@Mecrisp Hi! And thanks for came from the dark side and share your work! I had a look and seams really nice work. But unfortunately for my actual task don't help too much... I had already a a Verilog SDRAM controller (Is not mine but I tested and is working), and I wanted to re implement it in VHDL ( many reasons, like integrate with NeoRV32 without mixing VHDL and verilog, but the main reason, It was a personal chalenge). And I did it but never works... I suspect that could be a GHDL bug regarding "inout" ports, but couldnt verify yet. And last weeks I had some troubles at work, and lets be honest, I lose a lot of motivation. |
Hello again! I am studying how to enable the 32MB of SDRAM in the ULX3S, and I found in other projects interesting codes in VHDL that access to the ULX3S SDRAM (https://github.com/nullobject/sdram-fpga), but those are not Wishbone compatible (or at least in not mentioned). I found in the file "rtl/processor_templates/neorv32_ProcessorTop_MinimalBoot.vhd" that we have "MEM_EXT_EN" that suppose to be the connection with that SDRAM.
I would like to implement the controller to link the wishbone external memory with the VHDL ULX3S SDRAM. If its OK I start to do it and hopefully if my work allows me do a PR soon, but I will need a bit support. Do you like the idea?
The text was updated successfully, but these errors were encountered: