[lowrisc-dev] Can't execute SD card example on Nexys4 DDR
ws327 at cam.ac.uk
Fri Apr 1 12:42:41 BST 2016
My memory is vague now but if CMD58 returns 1, it could be a block
addressed SD ver 2? Suppose HC card should go through this path.
I use a 8GB microSD HC, high capacity normally means ver2 block addressed?
The Nexys4 DDR is ver C, PB200-292.
Vivado is 2015.4 I think but if you use 2015.1, it should be fine. I
will be surprised to know if it is caused by Vivado version.
On 01/04/2016 08:45, Alexis Ramos Amo wrote:
> Hello Wei,
> Thanks to your suggestion I've found that the problem is related with send_cmd(CMD58,0) at diskio.c, returning a non-zero value and not initializing the SD CARD.
> In order to discard hardware issues, could you provide me some information?
> - Which microSD card do you use (class, GB,...).
> - If your Nexys4 DDR is on Revision C.
> - Vivado version.
> Thank you for your help.
> -----Mensaje original-----
> De: Wei Song [mailto:ws327 at cam.ac.uk]
> Enviado el: jueves, 31 de marzo de 2016 13:04
> Para: Alexis Ramos Amo; lowrisc-dev at lists.lowrisc.org
> Asunto: Re: [lowrisc-dev] Can't execute SD card example on Nexys4 DDR
> Hello Alexis,
> I am afraid I run out of clue.
> No matter how you configure the FPGA (SD/JTAG/Flash), if you can see the error message "Fail to mount SD driver!", at least the FPGA is configured and UART is working.
> Then the question is why the Fat32 file system cannot be initialized on SD.
> Have you set the right jumper on board? But this must be a fake question. Without the right jumper, you cannot configure the FPGA in the first place.
> My suggestion can only be testing from the scratch because I cannot find any problem on my boards and I have not heard similar problems from others who had successfully booted the RISC-V Linux.
> You can have a look of the basic SPI API functions: driver/spi.c I would suggest you to manually initialize a SD card using the SPI mode.
> Some introduction is available from http://elm-chan.org/docs/mmc/mmc_e.html
> Since you have the UART working at least, you can print out the SD initialization procedure and see whether there is some issues related to SPI communication.
> Best regards,
> On 30/03/2016 20:41, Alexis Ramos Amo wrote:
>> Hello Wei,
>> Thank you four your fast answer.
>> No, I'm trying with the original code downloaded from GitHub (branch master) and Vivado 2015.4.1.
>> I've also tried with another Nexys4 and another card with the same result.
>> Thank you for your help
>> -----Mensaje original-----
>> De: Wei Song [mailto:ws327 at cam.ac.uk] Enviado el: miércoles, 30 de
>> marzo de 2016 11:49
>> Para: Alexis Ramos Amo <aramosam at nebrija.es>;
>> lowrisc-dev at lists.lowrisc.org
>> Asunto: Re: [lowrisc-dev] Can't execute SD card example on Nexys4 DDR
>> Hello Alexis Ramos Amo,
>> microSD is supported using a SPI interface and driving the the SD using a FatFS through the SPI mode.
>> UART is also supported as well, both read and write (the error message is actually comes from UART).
>> Configuring FPGA using PROG/UART and SD has been tested, which should work out of the box.
>> Not sure about configuration from Flash but I think it is OK.
>> You can see the error message, meaning the FPGA is configured.
>> I do not think you need to change the f_mount().
>> f_mount() happens after the FPGA is configured.
>> Have you changed any hardware design related to the SPI interface used by the SD or any C code related to SPI and FatFS?
>> It feels like something conflicting with the SPI interface.
>> On 30/03/2016 08:43, Alexis Ramos Amo wrote:
>>> Hello all,
>>> I'm trying to run "SD card read test" (sdcard.c) on my Nexys4 DDR but I get the following error:
>>> Fail to mount SD driver!
>>> Error! exit (0x00.1)
>>> The program is failing at the following line (in sdcard.c)
>>> if(f_mount(&FatFs, "", 1))
>>> I'm loading the bitstream from Quad-SPI Flash (the board is going to be re-configured several times, so I need the fastest programming procedure available). I get the same error loading it by PROG/UART, but I don't have any problem if I load the bitstream from microSD. The microSD HC is formatted on FAT32 (8GB).
>>> I've changed the option _FS_READONLY to 0 in order to allow writing on the SD. Also I've tried to change the path of f_mount (like if(f_mount(&FatFs, "1:", 1)) without success.
>>> . How can I read/write from SDCARD, if I load the bitstream from another different drive than the SD?
>>> . Also, Could I write into SPI Flash memory (instead of sdcard) if the bitstream is loaded from flash?
>>> Thank you for your help.
>>> Alexis Ramos Amo
>>> Researcher / PhD Student
>>> Electronic Design and Space Technology group Nebrija University
More information about the lowrisc-dev