Juggernaut
Juggernaut

注册于 8 months ago

回答
15
文章
0
关注者
0

这是那款SOC啊,内部flash这么大

跟进f_mkfs()stat = disk_initialize(pdrv);这个返回0是正常,第一次调用disk_ioctl()返回的时候sz_blk的值为1,第2次调用disk_ioctl()返回的时候ss的值为0;

    /* Check physical drive status */
    stat = disk_initialize(pdrv);
    if (stat & STA_NOINIT) return FR_NOT_READY;
    if (stat & STA_PROTECT) return FR_WRITE_PROTECTED;
    if (disk_ioctl(pdrv, GET_BLOCK_SIZE, &sz_blk) != RES_OK || !sz_blk || sz_blk > 32768 || (sz_blk & (sz_blk - 1))) sz_blk = 1;    /* Erase block to align data area */
#if _MAX_SS != _MIN_SS        /* Get sector size of the medium */
    if (disk_ioctl(pdrv, GET_SECTOR_SIZE, &ss) != RES_OK) return FR_DISK_ERR;
    if (ss > _MAX_SS || ss < _MIN_SS || (ss & (ss - 1))) return FR_DISK_ERR;

跟进去看了下,在disk_ioctl()函数执行如下代码的时候geometry没有拿到数据~
SFUD/FAL的大神能否帮忙看看

    else if (ctrl == GET_SECTOR_SIZE)
    {
        struct rt_device_blk_geometry geometry;

        rt_memset(&geometry, 0, sizeof(geometry));
        rt_device_control(device, RT_DEVICE_CTRL_BLK_GETGEOME, &geometry);

        *(WORD *)buff = (WORD)(geometry.bytes_per_sector);
    }

问题解决了,是SPI FLASH一个pin的电阻问题,感谢各位关注帮助;

>  \ | /
- RT -     Thread Operating System
 / | \     3.1.4 build Feb 21 2021
 2006 - 2019 Copyright by rt-thread team
rt_hw_spi_device_attach succ! 
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud.c:861) The flash device manufacturer ID is 0xEF, memory type ID is 0x40, capacity ID is 0x19.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:131) Check SFDP header is OK. The reversion is V1.0, NPN is 0.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:173) Check JEDEC basic flash parameter header is OK. The table id is 0, reversion is V1.0, length is 9, parameter table pointer is *[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:203) JEDEC basic flash parameter table info:
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:204) MSB-LSB  3    2    1    0
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0001] 0xFF 0xF3 0x20 0xE5
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0002] 0x0F 0xFF 0xFF 0xFF
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0003] 0x6B 0x08 0xEB 0x44
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0004] 0xBB 0x42 0x3B 0x08
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0005] 0xFF 0xFF 0xFF 0xFE
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0006] 0x00 0x00 0xFF 0xFF
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0007] 0xEB 0x21 0xFF 0xFF
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0008] 0x52 0x0F 0x20 0x0C
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:206) [0009] 0x00 0x00 0xD8 0x10
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:215) 4 KB Erase is supported throughout the device. Command is 0x20.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:234) Write granularity is 64 bytes or larger.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:245) Target flash status register is non-volatile.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:276) 3- or 4-Byte addressing.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:305) Capacity is 33554432 Bytes.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 4KB block erase. Command is 0x20.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 32KB block erase. Command is 0x52.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c:311) Flash device supports 64KB block erase. Command is 0xD8.
[SFUD] Find a Winbond flash chip. Size is 33554432 bytes.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud.c:840) Flash device reset success.
[SFUD] (..\..\..\components\drivers\spi\sfud\src\sfud.c:941) Enter 4-Byte addressing mode success.
[SFUD] W25Q256 flash device is initialize success.
[SFUD] Probe SPI flash W25Q256 by SPI device spi10 success.

SET_EVENT(device_socket, SIM800C_EVENT_CONN_OK | SIM800C_EVENT_CONN_FAIL)
无效吗

你好,感谢回复。
挂载片内flash是不是用这个API:dfs_mount()?
片上flash的device_name不知道,需要enable UFFS,然后dfs_mount("nand0", "/nand0", "uffs", 0, 0)?
这是我在github上找到case

发布
问题