395829833
395829833
这家伙很懒,什么也没写!

注册于 6年前

回答
21
文章
0
关注者
0

发布于6年前

只能说优点很优秀 缺点也很难受 总体还算不错
rt-thread上手门槛还是比较高的 毕竟东西多了自然也就复杂了

发布于6年前

[i=s] 本帖最后由 395829833 于 2018-8-3 17:21 编辑 [/i]

既然已经实现了spi总线驱动,那可以选择第三种方式,驱动flash非常的简单。只需要一个函数就可以实现flas …


探测不到???

  1. #include <rtthread.h>
  2. //#include <board.h>
  3. #include <stdint.h>
  4. #include <rtdevice.h>
  5. #include "spi_flash.h"
  6. #include "spi_flash_sfud.h"
  7. #ifdef RT_USING_LWIP
  8. #include "stm32_eth.h"
  9. #endif /* RT_USING_LWIP */
  10. #ifdef RT_USING_SPI
  11. #include "rt_stm32f10x_spi.h"
  12. #include "spi_flash_w25qxx.h"
  13. #define RT_USING_SPI1
  14. #if defined(RT_USING_DFS) && defined(RT_USING_SPI_MSD)
  15. #include "spi_msd.h"
  16. #endif /* RT_USING_DFS */
  17. /*
  18. * SPI1_MOSI: PA7
  19. * SPI1_MISO: PA6
  20. * SPI1_SCK : PA5
  21. *
  22. * CS0: PA4 SD card.
  23. */
  24. static int rt_hw_spi_init(void)
  25. {
  26. #ifdef RT_USING_SPI1
  27. /* register spi bus */
  28. {
  29. static struct stm32_spi_bus stm32_spi;
  30. GPIO_InitTypeDef GPIO_InitStructure;
  31. /* Enable GPIO clock */
  32. RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_AFIO,ENABLE);
  33. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
  34. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  35. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
  36. GPIO_Init(GPIOA, &GPIO_InitStructure);
  37. stm32_spi_register(SPI1, &stm32_spi, "spi1");
  38. }
  39. /* attach cs */
  40. {
  41. static struct rt_spi_device spi_device;
  42. static struct stm32_spi_cs spi_cs;
  43. GPIO_InitTypeDef GPIO_InitStructure;
  44. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  45. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  46. /* spi21: PG10 */
  47. spi_cs.GPIOx = GPIOA;
  48. spi_cs.GPIO_Pin = GPIO_Pin_4;
  49. RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  50. GPIO_InitStructure.GPIO_Pin = spi_cs.GPIO_Pin;
  51. GPIO_SetBits(spi_cs.GPIOx, spi_cs.GPIO_Pin);
  52. GPIO_Init(spi_cs.GPIOx, &GPIO_InitStructure);
  53. rt_spi_bus_attach_device(&spi_device, "spi1_25", "spi1", (void*)&spi_cs);
  54. }
  55. #endif /* RT_USING_SPI1 */
  56. return 0;
  57. }
  58. #endif /* RT_USING_SPI */
  59. void rt_platform_init(void)
  60. {
  61. #ifdef RT_USING_SPI
  62. rt_hw_spi_init();
  63. #if defined(RT_USING_DFS) && defined(RT_USING_SPI_MSD)
  64. /* init sdcard driver */
  65. {
  66. extern void rt_hw_msd_init(void);
  67. GPIO_InitTypeDef GPIO_InitStructure;
  68. /* PC4 : SD Power */
  69. RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
  70. GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4;
  71. GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
  72. GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  73. GPIO_Init(GPIOC, &GPIO_InitStructure);
  74. /* SD card power on. */
  75. GPIO_ResetBits(GPIOC, GPIO_Pin_4);
  76. rt_thread_delay(2);
  77. msd_init("sd0", "spi10");
  78. }
  79. #endif /* RT_USING_DFS && RT_USING_SPI_MSD */
  80. #endif // RT_USING_SPI
  81. #ifdef RT_USING_LWIP
  82. /* initialize eth interface */
  83. rt_hw_stm32_eth_init();
  84. #endif /* RT_USING_LWIP */
  85. }
  86. INIT_DEVICE_EXPORT(rt_hw_spi_init);
  87. void rt_spi_flash_device_init(void)
  88. {
  89. #if defined(RT_USING_DFS) && defined(RT_USING_DFS_ELMFAT)
  90. // w25qxx_init("flash0", "spi1_25");
  91. rt_sfud_flash_probe("W25QXX", "spi1_25");
  92. #endif /* RT_USING_DFS && RT_USING_DFS_ELMFAT */
  93. }

发布于6年前

挂在这一部分看起来没啥问题,估计还是flash读写那一块,你的flash驱动是怎么弄的?
第一种: 直接编写flas …


第二种

发布于6年前

挂在这一部分看起来没啥问题,估计还是flash读写那一块,你的flash驱动是怎么弄的?
第一种: 直接编写flas …


第二种

发布于6年前

求帮助!!!

发布于6年前

[i=s] 本帖最后由 395829833 于 2018-8-2 11:19 编辑 [/i]

求求求 支援!

发布于6年前

没事~现在资源占用情况具体怎么样?


Program Size: Code=70184 RO-data=5732 RW-data=908 ZI-data=46636

发布于6年前

不一定要用 936 呀,英文 437 应该就行。

多看看编程指南:https://www.rt-thread.org/document/site/rt


添加 unicode.c 文件 自动根据宏引用指定编码转换文件
可以支持英文大小写了

谢谢大哥的贴心帮忙 感谢

发布于6年前

修改完配置以后,有没有用 soncs —target=xyz 命令重新生成工程?


添加 cc936.c 解决问题
不过这个占用实在是难受!

发布于6年前

仔细看下我的选项,我选的是 3 ,确定下跟我的一不一样


第一次用ENV 还比较生疏

还是有报错 帮忙看下
.\build\rtthread-stm32.axf: Error: L6218E: Undefined symbol ff_convert (referred from ff.o).
.\build\rtthread-stm32.axf: Error: L6218E: Undefined symbol ff_wtoupper (referred from ff.o).

发布于6年前

你需要开启 长文件名 模式


....\components\dfs\filesystems\elmfat\ff.c(42): error: #35: #error directive: Static LFN work area cannot be used at thread-safe configuration

指点下 这个选项怎么弄
keil开发环境 STM32103

发布于6年前

也谢谢各位大哥的帮忙 再次感谢了:hug:

发布于6年前

你直接挂载到 /dev 分区是有问题的。

要在 SD 卡中新建一个文件夹,比如 /flash 然后:


OK了 谢谢大哥的帮忙了 也没什么可表示的 么么哒了!

这挂载方式挺别扭的 对于我这菜鸟而言! :lol

发布于6年前

你直接挂载到 /dev 分区是有问题的。

要在 SD 卡中新建一个文件夹,比如 /flash 然后:


貌似挂上了 不知道为什么创建的小写文件夹变成大写的了
dfs_mount(“flash0”, “/SD”, “elm”, 0, 0)

SD卡方面驱动不是很稳定!还是有报错出现

found part[0], begin: 66560, size: 952.959MB
W25Q32BV detection

flash0 mount to/.
mkdir ok!
sd0 mount to /dev.
finsh />ls(“/SD”)
Directory /SD:
read failed: 3, buffer 0x20005b64
0, 0x00000000

发布于6年前

有人成功同时挂载 SPI FLASH及SDIO SD两个存储器并且开启文件系统的吗?

回到
顶部

发布
问题

投诉
建议