2009-12-12 06:18:27     Strange SDCard issue

Document created by Aaronwu Employee on Aug 20, 2013
Version 1Show Document
  • View in full screen mode

2009-12-12 06:18:27     Strange SDCard issue

billy walton (UNITED KINGDOM)

Message: 83425   

 

Hi All,

 

I have been trying to get a FAT16/FAT32 SDCard working with 2009R1

 

I have enabled the relevent options in the kernel config, and can see the cards on boot

 

I can also mount the cards, and see the contents - however, every file is the same size

 

if i do a ls -l all the names are different but the sizes are the same

 

if i copy them all from the sd into ram, all the copied files have different names, but same sizes and same contents - i can vi 3 different text files and see the same contents - but on a windows machine all is good.

 

I have tried different mount options, like

 

mount -tmsdos and -tvfat, but always the same

 

root:/> mount -tvfat /dev/mmcblk0p1 /mnt/sd/

root:/> cd /mnt/sd/

root:/mnt/sd> ls

billydebug.txt  tickets.txt     yaamlic.llf

root:/mnt/sd> ls -l

-rwxr-xr-x    1 root     root         4647 Jun 25  2009 billydebug.txt

-rwxr-xr-x    1 root     root         4647 Jun 25  2009 tickets.txt

-rwxr-xr-x    1 root     root         4647 Jun 25  2009 yaamlic.llf

root:/mnt/sd>

 

 

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_b

ase@ffc00500, dma channel@17

mmc_spi spi0.1: ASSUMING 3.2-3.4 V slot power

mmc_spi spi0.1: SD/MMC host mmc0, no DMA, no WP, no poweroff

mmc_spi spi0.1: requested mode not fully supported

mmc_spi spi0.1: can't change chip-select polarity

Advanced Linux Sound Architecture Driver Version 1.0.18rc3.

dma_alloc_init: dma_page @ 0x01111000 - 256 pages at 0x01f00000

ALSA device list:

  #0: Dummy 1

  #1: ADI ad1836 at PF5 SPORT0,rx/tx dma ch:3/4,err irq:45

 

mmc0: host does not support reading read-only switch. assuming write-enable.

mmc0: new SD card on SPI

mmcblk0: mmc0:0000 SD02G 1.83 GiB

mmcblk0: p1

 

 

It does the same with many flavours of cards

 

i have enabled:

 

Block Layer, MMC block device driver and MMC/SD/SDIO over SPI in the kernel config, along with FAT support

 

Any help appreciated

 

Many thanks

QuoteReplyEditDelete

 

 

2009-12-14 01:28:46     Re: Strange SDCard issue

Yi Li (CHINA)

Message: 83464   

 

Billy,

 

Can you try to run "fdisk /dev/mmcblk0" to delete old partition, then create a new partition?

 

Then you may run "mkdosfs /dev/mmcblk0p1" or "mkfs.vfat /dev/mmcblk0p1" to create filesystem then try again?

 

I doulbt the file system does not work properly.

 

-Yi

QuoteReplyEditDelete

 

 

2009-12-14 03:09:05     Re: Strange SDCard issue

billy walton (UNITED KINGDOM)

Message: 83465   

 

Hi Yi,

 

 

 

Many thanks for your reply, please find below

 

root:/> fdisk /dev/mmcblk0

 

The number of cylinders for this disk is set to 60032.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

 

Command (m for help): d

Partition number (1-4): 1

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-60032, default 1): 1

Last cylinder or +size or +sizeM or +sizeK (1-60032, default 60032): 60032

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

mmcblk0: p1

mmcblk0: p1

 

WARNING: If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

information.

Syncing disks.

root:/> mkfs.vfat /dev/mmcblk0p1

mkfs.vfat 3.0.2 (28 Feb 2009)

root:/> cd /usr/bin/

root:/usr/bin> ls -l

-rw-r--r--    1 root     root         1192 Dec 12  2009 linconf.rc

-rw-r--r--    1 root     root           31 Dec 12  2009 lisgw.rc

lrwxrwxrwx    1 root     root            4 Dec 12  2009 reset -> tset

-rwxr-xr-x    1 root     root        16896 Dec 12  2009 tset

root:/usr/bin> mount -tvfat /dev/mmcblk0p1 /mnt/

root:/usr/bin> cp *.rc /mnt/

root:/usr/bin> cd /mnt/

root:/mnt> ls -l

-rwxr-xr-x    1 root     root         1192 Jan  1 00:03 linconf.rc

-rwxr-xr-x    1 root     root         1192 Jan  1 00:03 lisgw.rc

root:/mnt>

 

 

So the file sizes are the same! if i vi either file from the disk now, the contents are also the same

 

Kindest regards

 

Billy

QuoteReplyEditDelete

 

 

2009-12-14 04:28:27     Re: Strange SDCard issue

Yi Li (CHINA)

Message: 83484   

 

What is the result if using ext2/ext3?

 

-Yi

QuoteReplyEditDelete

 

 

2009-12-14 04:48:53     Re: Strange SDCard issue

billy walton (UNITED KINGDOM)

Message: 83485   

 

It seems fine

 

root:/> fdisk /dev/mmcblk0

 

The number of cylinders for this disk is set to 60032.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

   (e.g., DOS FDISK, OS/2 FDISK)

 

Command (m for help): d

Partition number (1-4): 1

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-60032, default 1): 1

Last cylinder or +size or +sizeM or +sizeK (1-60032, default 60032): 60032

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

mmcblk0: p1

mmcblk0: p1

 

WARNING: If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

information.

Syncing disks.

root:/> mk

mkdir       mke2fs      mkfs.ext2   mkfs.msdos  mknod

mkdosfs     mkfifo      mkfs.ext3   mkfs.vfat

root:/> mke2fs /dev/mmcblk0p1

mke2fs 1.41.4 (27-Jan-2009)

ext2fs_check_if_mount: No such file or directory while determining whether /dev/

mmcblk0p1 is mounted.

Filesystem label=

OS type: Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

120240 inodes, 480254 blocks

24012 blocks (5.00%) reserved for the super user

First data block=0

Maximum filesystem blocks=494927872

15 block groups

32768 blocks per group, 32768 fragments per group

8016 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912

 

Writing inode tables: done

Writing superblocks and filesystem accounting information: done

 

This filesystem will be automatically checked every 20 mounts or

180 days, whichever comes first.  Use tune2fs -c or -i to override.

root:/> mount /dev/mmcblk0p1 /mnt

root:/> cd /mnt

root:/mnt> ls

lost+found

root:/mnt> cp /usr/bin/*.rc /mnt

root:/mnt> ls -l

-rw-r--r--    1 root     root         1192 Jan  1 00:02 linconf.rc

-rw-r--r--    1 root     root           31 Jan  1 00:02 lisgw.rc

drwx------    2 root     root        16384 Jan  1 00:01 lost+found

root:/mnt>

 

 

 

 

Billy

QuoteReplyEditDelete

 

 

2009-12-15 09:52:51     Re: Strange SDCard issue

billy walton (UNITED KINGDOM)

Message: 83530   

 

Hi Yi,

 

I have been doing some more tests on this, it seems with ext2/3 all is great, hundreds of files can be copied and accessed without issue.  As soon as i reformat it for either msdos/vfat i get the same problem.

 

I can even format it in ext2, use it for a bit, format it using vfat, get the problem, format it back and it works again - so im pretty happy all is looking good on my SPI port.

 

I have tried 4 different cards, 2 san disks and 2 kingstons, and observed the same results.

 

I am of the opionion that due to ext2/3 success i can rule out an issue with my hardware - would you agree with that?

 

I agree with you and your statement about you doubting the filesystem being the problem, so i am wondering if any kind of  flag/access issue could be involved on the device table entry which may effect the FAT code?

 

Kindest regards

 

billy,

QuoteReplyEditDelete

 

 

2009-12-15 12:34:26     Re: Strange SDCard issue

Mike Frysinger (UNITED STATES)

Message: 83531   

 

create a file in ram, format it VFAT, and then mount it loopback and see if the same problem occurs

Attachments

    Outcomes