Discussion:
sd card mounting trouble
(too old to reply)
kc_dtm@yahoo.com [nuttx]
2018-01-08 06:29:55 UTC
Permalink
Hi all,


I have some problem with mount of sd card. Board is sam4s-xplained, using spi0.
Attached file is a debug output.
All things ended with error 19.
I tried same thing with nucleo(stm32f429) board and result is the same.
I'm sure that I miss something but I don't know what is it.
Card is formatted with fat32 fs.


Thanks in advance
spudarnia@yahoo.com [nuttx]
2018-01-08 13:50:58 UTC
Permalink
Or, if you turn on file system debug output (CONFIG_DEBUG_FS, CONFIG_DEBUG_FS_INFO, etc.) it will probably just tell you what happened.
spudarnia@yahoo.com [nuttx]
2018-01-08 13:49:31 UTC
Permalink
The error 19 is ENODEV:

$ grep ENODEV ../../include/errno.h
#define ENODEV 19
#define ENODEV_STR "No such device"

It is being reported by fat_bind() in fs/fat/fs_fat32.c but I do not know why.

You should put a breakpoint on fat_bind() and single step through that logic to see why ENODEV is being reported.

Greg
spudarnia@yahoo.com [nuttx]
2018-01-08 13:57:49 UTC
Permalink
Another thing that I notice is that BEFORE switch to the higher speed, all of the SPI transfers look okay.

spi_exchange: txbuffer=20000d0e rxbuffer=20000d0f nwords=1
spi_send: Sent ff received 09
spi_exchange: txbuffer=20000d0e rxbuffer=20000d0f nwords=1
spi_send: Sent ff received 93
...

Then it switches to the higher speed:

spi_setfrequency: cs=0 frequency=20000000
...

After that, all of the SPI transfers look bad (a response of ff usually means that the SPI is not communicating with the device):

spi_exchange: txbuffer=20000d6e rxbuffer=20000d6f nwords=1
spi_send: Sent ff received ff
...
spi_exchange: txbuffer=20000d26 rxbuffer=20000d27 nwords=1
spi_send: Sent ff received ff

Greg
kc_dtm@yahoo.com [nuttx]
2018-01-08 18:24:40 UTC
Permalink
Hi,


After some investigation, I found the reason for a wrong behavior:
The function sam_spi0status(...) always returns 0, so error ENODEV is true.
When I wrote correct one all tings went smoothly.


Mr. Greg thank for the guidelines, helped me a lot.


Best regards

Loading...