Mounting/Accessing SD-Card on BBB

Christian Mauderer list at c-mauderer.de
Thu Aug 15 17:27:04 UTC 2019


Hello Nils,

does some other access to the file system work? Like a ls on the console
or creating a file. Can you do a `cat` on some text file on the file
system? If not: Does it work for a file in the root file system (should
be a IMFS)?

Best regards

Christian

On 15/08/2019 15:54, Nils Hölscher wrote:
> Hi,
> 
> I when my app wants to open a file on the SD card dev=mmcsd-0-0 rtems
> freezes.
> Exact call is:
> fd = open(file, O_RDONLY);
> With file being the pru binary I want to upload.
> 
> Thanks,
> Nils
> 
> On Tue, 13 Aug 2019 at 17:56, Christian Mauderer
> <christian.mauderer at embedded-brains.de
> <mailto:christian.mauderer at embedded-brains.de>> wrote:
> 
>     Hello Nils,
> 
>     a third possibility: You could start a FTP server and push the file
>     via network.
> 
>     Best regards
> 
>     Christian
> 
>     Am Dienstag, 13. August 2019 schrieb Nils Hölscher:
>     > Hi,
>     >
>     >
>     > Thanks for the input I will try the SD card first.
>     > That way I won't have to alter the code when I want to run other
>     stuff on the pru.
>     >
>     >
>     > Best,
>     > Nils
>     >
>     >
>     > On Tue, 13 Aug 2019 at 17:32, Gedare Bloom <gedare at rtems.org
>     <mailto:gedare at rtems.org>> wrote:
>     >
>     > You can also build the PRU image into the RTEMS binary. See
>     > examples-v2.git/file_io/crc/init.c
>     >
>     > On Tue, Aug 13, 2019 at 8:46 AM Christian Mauderer
>     <list at c-mauderer.de <mailto:list at c-mauderer.de>> wrote:
>     > >
>     > > Hello Nils,
>     > >
>     > > that's a bit odd. I attached an expected output below. Some guesses:
>     > >
>     > > - Did you add FAT file system to your application?
>     > > - Is there some odd formatting on the SD? Normally at least the FAT
>     > > partition used by U-Boot should be visible.
>     > > - Is your BDBUF configuration OK?
>     > > - Do you have enough file descriptors?
>     > >
>     > > Beneath that: If you only need something where you can put some
>     files,
>     > > you can try to connect a USB stick instead. Maybe that works better.
>     > >
>     > > Best regards
>     > >
>     > > Christian
>     > >
>     > >
>     > > media listener: event = DISK ATTACH, state = INQUIRY, src = mmcsd
>     > > media listener: event = DISK ATTACH, state = SUCCESS, src =
>     mmcsd, dest
>     > > = /dev/mmcsd-0
>     > > media listener: event = MOUNT, state = INQUIRY, src = /dev/mmcsd-0
>     > > mmcsd0: 4GB <SDHC TO 15.15 SN 000002F6 MFG 02/2017 by 25 DY> at mmc0
>     > > 24.0MHz/4bit/65535-block
>     > > media listener: event = MOUNT, state = FAILED, src = /dev/mmcsd-0
>     > > media listener: event = PARTITION INQUIRY, state = INQUIRY, src =
>     > > /dev/mmcsd-0
>     > > media listener: event = PARTITION INQUIRY, state = SUCCESS, src =
>     > > /dev/mmcsd-0
>     > > media listener: event = PARTITION ATTACH, state = INQUIRY, src =
>     > > /dev/mmcsd-0
>     > > media listener: event = PARTITION ATTACH, state = SUCCESS, src =
>     > > /dev/mmcsd-0, dest = /dev/mmcsd-0-0
>     > > media listener: event = MOUNT, state = INQUIRY, src = /dev/mmcsd-0-0
>     > > media listener: event = MOUNT, state = SUCCESS, src =
>     /dev/mmcsd-0-0,
>     > > dest = /media/mmcsd-0-0
>     > > media listener: event = DISK ATTACH, state = INQUIRY, src = mmcsd
>     > > media listener: event = DISK ATTACH, state = SUCCESS, src =
>     mmcsd, dest
>     > > = /dev/mmcsd-1
>     > > media listener: event = MOUNT, state = INQUIRY, src = /dev/mmcsd-1
>     > > mmcsd1: 4GB <MMCHC MMC04G 5.8 SN 160D224B MFG 09/2014 by 112
>     0x0000> at
>     > > mmc1 48.0MHz/8bit/65535-block
>     > > media listener: event = MOUNT, state = FAILED, src = /dev/mmcsd-1
>     > > media listener: event = PARTITION INQUIRY, state = INQUIRY, src =
>     > > /dev/mmcsd-1
>     > > media listener: event = PARTITION INQUIRY, state = FAILED, src =
>     > > /dev/mmcsd-1
>     > > media listener: event = DISK ATTACH, state = INQUIRY, src =
>     mmcsd1boot
>     > > mmcsd1boot0: 2MB partion 1 at mmcsd1
>     > > mmcsd1boot1: 2MB partion 2 at mmcsd1
>     > > mmcsd1rpmb: 131kB partion 3 at mmcsd1
>     > >
>     > >
>     > > On 13/08/2019 13:30, Nils Hölscher wrote:
>     > > > Hi,
>     > > >
>     > > > Thanks for the help.
>     > > > I tried to use your code, but I always get "ERROR: SD could not be
>     > > > mounted after timeout".
>     > > > Even after raising the waiting time.
>     > > >
>     > > > The sources I use start here:
>     > > > https://github.com/nilhoel1/rtems-pru/blob/pruss-shell/main.c#L110
>     > > >
>     > > > And my uart output is:
>     > > > ""
>     > > > waiting for SD...
>     > > >
>     > > > usbus0: 480Mbps High Speed USB v2.0
>     > > > usbus1: 480Mbps High Speed USB v2.0
>     > > > media listener: event = DISK ATTACH, state = INQUIRY, src = mmcsd
>     > > > media listener: event = DISK ATTACH, state = SUCCESS, src =
>     mmcsd, dest
>     > > > = /dev/mmcsd-0
>     > > > media listener: event = MOUNT, state = INQUIRY, src = /dev/mmcsd-0
>     > > > ugen0.1: <Mentor Graphics OTG Root HUB> at usbus0
>     > > > ugen1.1: <Mentor Graphics OTG Root HUB> at usbus1
>     > > > uhub0: <Mentor Graphics OTG Root HUB, class 9/0, rev
>     2.00/1.00, addr 1>
>     > > > on usbus0
>     > > > uhub1: <Mentor Graphics OTG Root HUB, class 9/0, rev
>     2.00/1.00, addr 1>
>     > > > on usbus1
>     > > > media listener: event = MOUNT, state = FAILED, src = /dev/mmcsd-0
>     > > > media listener: event = PARTITION INQUIRY, state = INQUIRY, src =
>     > > > /dev/mmcsd-0
>     > > > media listener: event = PARTITION INQUIRY, state = SUCCESS, src =
>     > > > /dev/mmcsd-0
>     > > > media listener: event = PARTITION ATTACH, state = INQUIRY, src =
>     > > > /dev/mmcsd-0
>     > > > media listener: event = PARTITION ATTACH, state = SUCCESS, src =
>     > > > /dev/mmcsd-0, dest = /dev/mmcsd-0-0
>     > > > media listener: event = MOUNT, state = INQUIRY, src =
>     /dev/mmcsd-0-0
>     > > > media listener: event = MOUNT, state = FAILED, src =
>     /dev/mmcsd-0-0
>     > > > media listener: event = DISK ATTACH, state = INQUIRY, src = mmcsd
>     > > > media listener: event = DISK ATTACH, state = SUCCESS, src =
>     mmcsd, dest
>     > > > = /dev/mmcsd-1
>     > > > media listener: event = MOUNT, state = INQUIRY, src = /dev/mmcsd-1
>     > > > media listener: event = MOUNT, state = FAILED, src = /dev/mmcsd-1
>     > > > media listener: event = PARTITION INQUIRY, state = INQUIRY, src =
>     > > > /dev/mmcsd-1
>     > > > media listener: event = PARTITION INQUIRY, state = SUCCESS, src =
>     > > > /dev/mmcsd-1
>     > > > media listener: event = PARTITION ATTACH, state = INQUIRY, src =
>     > > > /dev/mmcsd-1
>     > > > media listener: event = PARTITION ATTACH, state = SUCCESS, src =
>     > > > /dev/mmcsd-1, dest = /dev/mmcsd-1-0
>     > > > media listener: event = MOUNT, state = INQUIRY, src =
>     /dev/mmcsd-1-0
>     > > > media listener: event = MOUNT, state = FAILED, src =
>     /dev/mmcsd-1-0
>     > > > media listener: event = DISK ATTACH, state = INQUIRY, src =
>     mmcsd1boot
>     > > > uhub0: 1 port with 1 removable, self powered
>     > > > uhub1: 1 port with 1 removable, self powered
>     > > > ERROR: SD could not be mounted after timeout
>     > > > ""
>     > > >
>     > > > Thanks,
>     > > > Nils
>     > > >
>     > > > On Mon, 12 Aug 2019 at 18:01, Christian Mauderer
>     <list at c-mauderer.de <mailto:list at c-mauderer.de>
>     > > > <mailto:list at c-mauderer.de <mailto:list at c-mauderer.de>>> wrote:
>     > > >
>     > > >     On 12/08/2019 07:28, Nils Hölscher wrote:
>     > > >     > Hi,
>     > > >     >
>     > > >     > Can anyone help me with this?
>     > > >     > I need to access the BBB's SD-Card, so that I can load
>     my pru
>     > > >     example on
>     > > >     > the pru.
>     > > >     >
>     > > >     > Thanks,
>     > > >     > Nils
>     > > >     >
>     > > >
>     > > >     Hello Nils,
>     > > >
>     > > >     take a look at the following application:
>     > > >
>     > > >   
>      https://gitlab.com/c-mauderer/rtems-bbb/blob/master/apps/wifi-sample/init.c#L64
>     > > >
>     > > >   
>      https://gitlab.com/c-mauderer/rtems-bbb/blob/master/apps/wifi-sample/libbsdhelper.c#L122
>     > > >
>     > > >     You should mainly need the stuff from the
>     libbsdhelper_init_sd_card()
>     > > >     and libbsdhelper_wait_for_sd().
>     > > >
>     > > >     Please note that the SD card needs quite some time to
>     initialize on BBB.
>     > > >     I haven't had a look at it why that is the case.
>     > > >
>     > > >     Best regards
>     > > >
>     > > >     Christian
>     > > >
>     > > >
>     > > > _______________________________________________
>     > > > users mailing list
>     > > > users at rtems.org <mailto:users at rtems.org>
>     > > > http://lists.rtems.org/mailman/listinfo/users
>     > > >
>     > > _______________________________________________
>     > > users mailing list
>     > > users at rtems.org <mailto:users at rtems.org>
>     > > http://lists.rtems.org/mailman/listinfo/users
>     >
> 
>     -- 
>     -- 
>     --------------------------------------------
>     embedded brains GmbH
>     Herr Christian Mauderer
>     Dornierstr. 4
>     D-82178 Puchheim
>     Germany
>     email: christian.mauderer at embedded-brains.de
>     <mailto:christian.mauderer at embedded-brains.de>
>     Phone: +49-89-18 94 741 - 18
>     Fax:   +49-89-18 94 741 - 08
>     PGP: Public key available on request.
> 
>     Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
> 
> 
> _______________________________________________
> users mailing list
> users at rtems.org
> http://lists.rtems.org/mailman/listinfo/users
> 



More information about the users mailing list