yjdwbj opened a new pull request #2464: URL: https://github.com/apache/incubator-nuttx/pull/2464
Fixed: SDIO Interface hanging after inserted SD Card. ## Summary Added: MT29F2G Nand Flash block driver for sam4s-xplained-pro. Fixed: SDIO Interface hanging after inserted SD Card. The originally `sam4s-xplained-pro:nsh` can running a `nsh shell` if have no SD Card inserted. But reboot every 5s. No driver for the MT29F2G on board. About the SD Card hanging problem . _Originally posted by @yjdwbj in https://github.com/apache/incubator-nuttx/issues/2276#issuecomment-735631494_ . I found a suspicious function `usleep(MMCSD_CLK_DELAY)` at `mmcsd/mmcsd_sdio.c:2780` and `mmcsd/mmcsd_sdio.c:2648`. Then I changed `up_udelay(MMCSD_CLK_DELAY)` replace to `usleep(MMCSD_CLK_DELAY)`, the hanging problem has gone. According to the `MT29F2G Data Sheet` and the `Atmel-11100K-ATARM-SAM4S-Datasheet_09-Jun-15.pdf` write the driver for the MTD interface. But the `mkfatfs` can only format it as `FAT16` not `FAT32`. I would love to know that someone who have the same `sam4s-xplained-pro` board to testing SD Card and Nand flash. If you have one and use these driver function , please give me a feedback. ## Impact ## Testing ```sh nsh> df Block Number Size Blocks Used Available Mounted on 16384 15611 2100 13511 /fat 0 0 0 0 /proc nsh> mount -t vfat /dev/mtdblock0 /flash nsh> df Block Number Size Blocks Used Available Mounted on 16384 15611 2100 13511 /fat 65536 4095 3 4092 /flash 0 0 0 0 /proc nsh> cat /flash/test.txt NuttX 10.0.0 9315fe21ed-dirty Dec 2 2020 21:24:31 arm sam4s-xplained-pro ``` hexdump context ```sh nsh> hexdump /dev/mtdblock0 count=256 /dev/mtdblock0 at 00000000: 0000: eb 3c 90 4e 55 54 54 58 20 20 20 00 08 20 01 00 .<.NUTTX .. .. 0010: 02 00 02 00 00 f8 05 00 3f 00 ff 00 00 00 00 00 ........?....... 0020: 00 00 02 00 00 00 29 00 00 00 00 20 20 20 20 20 ......).... 0030: 20 20 20 20 20 20 46 41 54 31 36 20 20 20 0e 1f FAT16 .. 0040: be 5b 7c ac 22 c0 74 0b 56 b4 0e bb 07 00 cd 10 .[|.".t.V....... 0050: 5e eb f0 32 e4 cd 16 cd 19 eb fe 54 68 69 73 20 ^..2.......This 0060: 69 73 20 6e 6f 74 20 61 20 62 6f 6f 74 61 62 6c is not a bootabl 0070: 65 20 64 69 73 6b 2e 20 20 50 6c 65 61 73 65 20 e disk. Please 0080: 69 6e 73 65 72 74 20 61 20 62 6f 6f 74 61 62 6c insert a bootabl 0090: 65 20 66 6c 6f 70 70 79 20 61 6e 64 0d 0a 70 72 e floppy and..pr 00a0: 65 73 73 20 61 6e 79 20 6b 65 79 20 74 6f 20 74 ess any key to t 00b0: 72 79 20 61 67 61 69 6e 20 2e 2e 2e 0d 0a 00 00 ry again ....... 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org