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
Test SDCard boot with OrangeCrab #123
Comments
@gregdavill is it still possible to drop to the LiteX BIOS with the current USB CDC setup? |
@pdp7: sorry i miss the fact the OrangeCrab was using USB CDC. With: enjoy-digital/litex@b509df8, litex-hub/litex-boards@4053c02 and 2cf330d it should now be possible. Here is the bitstream if you want to test: orangecrab_usb_cdc_spisdcard.zip :) |
Nice I'll check this out soon. On ECP5 I've previously used one of the open cores SD gateware: https://github.com/gregdavill/bosonFrameGrabber/tree/master/fw/bosonECP5/source/sdc_dma/verilog SPI is a good first step, I've seen there is some recent work on implementing a PHY layer for the ECP5 in liteSDCard |
I put the files on an SD Card but maybe my problem is
The files:
Nothing happens when I plug into USB other than it runs the blink LED gateware demo.
|
@gregdavill is there a way for me to stop the crab from booting vexriscv and keep at the litex bios prompt? when I open serial port /dev/ttyUSB0, it immediately boots |
@gregdavill ah, I just needed to be fast and hit ESC right away |
@enjoy-digital I don't see
|
Ah ok, I was misunderstanding. I have run:
gives me:
and opening tttyACM0:
|
I did it manual with fdisk and mkfs.vfat
|
@gregdavill @enjoy-digital it now seems to be stuck in Liftoff:
|
@pdp7: thanks for the test, that's already good the USB CDC is working. For the SDCard issue, i suspect the reclocking. Can you do a test with the attached bitstream with reclocking disabled? It will be slower since the SDCard is only running at 400KHz but it will allow us to know if that's the issue. |
Just a thought about reclocking. I aimed for 16MHZ, although on the
DE10nano this, as I was being conservative, actually goes to 12.5MHZ. I
also have a class 10 card.
Is it worth aiming for a slower speed? Is it worth actually checking the
speed class of the card, if that is possible, and acting accordingly?
Rob.
…On Thu, 26 Mar 2020, 06:45 enjoy-digital, ***@***.***> wrote:
@pdp7 <https://github.com/pdp7>: thanks for the test, that's already good
the USB CDC is working. For the SDCard issue, i suspect the reclocking. Can
you do a test with the attached bitstream with reclocking disabled? It will
be slower since the SDCard is only running at 400KHz but it will allow us
to know if that's the issue.
orangecrab_usb_cdc_spisdcard_no_reclocking.zip
<https://github.com/litex-hub/linux-on-litex-vexriscv/files/4385459/orangecrab_usb_cdc_spisdcard_no_reclocking.zip>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN4SYTYKEPNTOQICNBK3D73RJL22DANCNFSM4LTJ46MA>
.
|
@rob-ng15: i would say we could wait the result at 400KHz to see if that's really the issue here. If this is the issue and checking the class speed is easy to do, that's something we should probably indeed add. |
What is the processor speed of the orange crab? It may be that the minimum
divider needs increasing, that may be a good step, say from 2 to 4.
I only have class 10 cards, so I picked a default that works for that. My
cards are all SanDisk too, my cards all work at 25mhz, but I went for less
than 20mhz as a safe option.
I'd suggest if we have to go slower aiming for 8mhz or less.
Rob.
…On Thu, 26 Mar 2020, 11:13 enjoy-digital, ***@***.***> wrote:
@rob-ng15 <https://github.com/rob-ng15>: i would say we could wait the
result at 400KHz to see if that's really the issue here. If this is the
issue and checking the class speed is easy to do, that's something we
should probably indeed add.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN4SYT6U6WXESN2UCZNGJHLRJM2HHANCNFSM4LTJ46MA>
.
|
@gregdavill @enjoy-digital is there anyway I can debug that further? |
That means that the file allocation table didn't read correctly, or was
corrupted.
…On Thu, 26 Mar 2020, 17:54 Drew Fustini, ***@***.***> wrote:
orangecrab_usb_cdc_spisdcard_no_reclocking.zip
<https://github.com/litex-hub/linux-on-litex-vexriscv/files/4385459/orangecrab_usb_cdc_spisdcard_no_reclocking.zip>
I tried this but no output after Liftoff:
5 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535
Reading File [RV32.DTB] into 0x41000000 : File starts at Cluster 6149 length 1707
Clusters: 6149
Reading File [EMULATOR.BIN] into 0x41100000 : File starts at Cluster 3 length 9600
Clusters: 3 0 111 69 449
Executing booted program at 0x41100000
--============= Liftoff! ===============--
@gregdavill <https://github.com/gregdavill> @enjoy-digital
<https://github.com/enjoy-digital> is there anyway I can debug that
further?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN4SYT5B2ADTBOHHEO6CPNLRJOJFVANCNFSM4LTJ46MA>
.
|
I had this issue when developing the code. I ended up repartitioning the
card and rewriting the files to it.
To debug, remove the boot(...) from boot.c and use the mr command to see
what data has been read into memory.
Rob.
…On Thu, 26 Mar 2020, 18:59 Rob Shelton, ***@***.***> wrote:
That means that the file allocation table didn't read correctly, or was
corrupted.
On Thu, 26 Mar 2020, 17:54 Drew Fustini, ***@***.***> wrote:
> orangecrab_usb_cdc_spisdcard_no_reclocking.zip
> <https://github.com/litex-hub/linux-on-litex-vexriscv/files/4385459/orangecrab_usb_cdc_spisdcard_no_reclocking.zip>
> I tried this but no output after Liftoff:
>
> 5 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535
>
> Reading File [RV32.DTB] into 0x41000000 : File starts at Cluster 6149 length 1707
> Clusters: 6149
>
> Reading File [EMULATOR.BIN] into 0x41100000 : File starts at Cluster 3 length 9600
> Clusters: 3 0 111 69 449
>
> Executing booted program at 0x41100000
>
> --============= Liftoff! ===============--
>
> @gregdavill <https://github.com/gregdavill> @enjoy-digital
> <https://github.com/enjoy-digital> is there anyway I can debug that
> further?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#123 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AN4SYT5B2ADTBOHHEO6CPNLRJOJFVANCNFSM4LTJ46MA>
> .
>
|
I'll try reducing the reclock to 8MHZ or at least divide 4 on the reclock. I think I have found documentation to read the card speed. What class/make of card do you have? |
@enjoy-digital is if there is are way for me to rebuild bitsream for testing different clock speeds with the SD card? @rob-ng15 it is a generic 16GB MicroSD from a computer store (MicroCenter). It says Class 10. I could try another brand if you think that might help. |
I just tried a SanDisk Class 10 card. I should note that this is what happens at first:
then if I run the command again:
so this time it ends with an error:
|
Here are the results with new SD card (SanDisk class 10) and bitstream from @enjoy-digital
|
Just been reading a little bit more. The code I wrote will only work on
sdhc cards, not sdxc, etc due to the block sizes.
From what I can see, all cards should work at 8mhz.
It does look like the file allocation table is not being read/stored
properly, looking at the list of clusters being read; there should never be
a repeat.
Data is being read correctly from the card at some point, the MBR and root
directory, otherwise there'd be an error earlier in the process.
…On Fri, 27 Mar 2020, 00:24 Drew Fustini, ***@***.***> wrote:
Here are the results with new SD card (SanDisk class 10) and bitstream
from @enjoy-digital <https://github.com/enjoy-digital>
orangecrab_usb_cdc_spisdcard_no_reclocking.zip
sdcardboot
SD Card via SPI Initialising
Reading MBR
Partition 1 Information: Active=0x00, Type=0x06, LBAStart=0x00000800
Partition 1 is FAT16
Read FAT16 Boot Sector
Jump Code: 0xeb 0x3c 0x90
OEM Code: [mkfs.fat]
Sector Size: 512
Sectors Per Cluster: 4
Reserved Sectors: 4
Number of Fats: 2
Root Dir Entries: 512
Total Sectors Short: 0
Media Descriptor: 0xf8
Fat Size Sectors: 200
Sectors Per Track: 32
Number of Heads: 64
Hidden Sectors: 2048
Total Sectors Long: 204800
Drive Number: 0x80
Current Head: 0x01
Boot Signature: 0x29
Volume ID: 0xcac4def6
Volume Label: [NO NAME ]
Volume Label: [FAT16 ]
Boot Sector Signature: 0xaa55
sdCardFat16RootDir = 0x47fe3000 Reading Root Directory (32 Sectors Long)
Root Directory
File 0 [Ae m u l. a ] @ Cluster 0 for 110 bytes
File 1 [EMULATOR.BIN] @ Cluster 4455 for 9600 bytes
File 2 [AI m a g. e ] @ Cluster 0 for -1 bytes
File 3 [IMAGE . ] @ Cluster 4460 for 4545524 bytes
File 4 [Ar v 3 2. . ] @ Cluster 0 for -1 bytes
File 5 [RV32 .DTB] @ Cluster 4454 for 1707 bytes
File 6 [Ar o o t. f ] @ Cluster 0 for -65536 bytes
File 7 [ROOTFS~1.CPI] @ Cluster 6680 for 8029184 bytes
Reading File [IMAGE.] into 0x40000000 : File starts at Cluster 4460 length 4545524
Clusters: 4460 11299 12469 0 111 69 449 58591 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 [SNIP]
65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535 65535
Reading File [RV32.DTB] into 0x41000000 : File starts at Cluster 4454 length 1707
Clusters: 4454
Reading File [EMULATOR.BIN] into 0x41100000 : File starts at Cluster 4455 length 9600
Clusters: 4455 23 65137 65535 65535
Executing booted program at 0x41100000
--============= �[1mLiftoff!�[0m ===============--
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#123 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AN4SYT4ALKBOIJAZTLOGCWLRJPW3FANCNFSM4LTJ46MA>
.
|
@rob-ng15 all the cards I have are 16GB microSD SDHC class 10 (sandisk and microcenter brands). Should that be ok? I could try to buy older 8GB class 4 card. @enjoy-digital @gregdavill have you tried any SD cards? |
@gsomlo thatnks for the advice in irc. what hardware are you testing with? |
@enjoy-digital @gregdavill is there a branch I can use to built the bitstream myself? |
@pdp7: you should be able to build it with upstream repos. ValentyUSB is automatically cloned when building the OrangeCrab bitstream: https://github.com/litex-hub/linux-on-litex-vexriscv/blob/master/make.py#L221. |
@enjoy-digital thanks I'll try it out |
On Sat, Mar 28, 2020 at 10:24:49AM -0700, Drew Fustini wrote:
@gsomlo thatnks for the advice in irc. what hardware are you testing with?
nexys4ddr and trellisboard
|
The code has been refactored (to use FatFs and allow FAT16/FAT32 partitions), performance has been improved (>1MB/s transfers) and has been tested recently on the OrangeCrab: https://twitter.com/enjoy_digital/status/1271128930385362947 A new wiki page that explains the different boot options is also available at: https://github.com/enjoy-digital/litex/wiki/Load-Application-Code-To-CPU |
I just added SDCard SPI-Mode support to the OrangeCrab with: litex-hub/litex-boards@6e6b6da and
dc61f0a but don't have the harware to test it.
@pdp7, @gregdavill interested in testing? :)
If so, you can use the attached bitstream and copy the attached images to a FAT16 formated SDCard.
Then just try to boot with
spisdcardboot
command. (that's possible you'll have to type it twice since the SDCard does not always seem to be initialized correctly the first time).orangecrab_linux_images.zip
orangecrab_bitstream_with_spisdcard.zip
The text was updated successfully, but these errors were encountered: