sync
sync
This guy hasn't written anything yet

注册于 3 years ago

回答
151
文章
3
关注者
3

不过调试RW007,执行wifi scan似乎wifi也是不能正常工作
[code]msh />wifi scan

LDO Mode, BD_Info: 0
scan ap down
ap down
SID MAC security rssi chn Mbps
------------------------------- ----------------- -------------- ---- --- ----
 00:00:00:00:00:00 UNKNOWN 0 281 0
00:00:00:00:00:00 OPEN 0 0 0
00:00:00:00:00:00 OPEN 0 0 0
00:00:00:00:00:00 OPEN 0 0 0

查看了rw007的调试口,应该是进入spi模式了,打印信息如下:

 \ | /
- RT - Thread Operating System
/ | \ 3.1.1 build Dec 19 2019
2006 - 2018 Copyright by rt-thread team
lwIP-2.0.2 initialized!

LDO Mode, BD_Info: 0

LDO Mode, BD_Info: 0
i2c_idx:0
[I/SAL_SOC] Socket Abstraction Layer initialize success.
[start_value]: 3
AT uart mode init
[I/at.svr] RT-Thread AT server (V1.2.0) initialize success.
[I/WLAN.dev] wlan init success
[I/WLAN.lwip] eth device init ok name:w0
[I/WLAN.dev] wlan init success
[I/WLAN.lwip] eth device init ok name:w1


Mac:88:97:46:07:c7:e7
rw007 sn: [rw007746978800e7c7]
rw007 ver: [1.2.9-72a55281-28908]

[D/FAL] (fal_flash_init:63) Flash device | norflash0 | addr: 0x00000000 | len: 0x00200000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | app | norflash0 | 0x0000b000 | 0x00135000 |
[I/FAL] | env | norflash0 | 0x00140000 | 0x00001000 |
[I/FAL] | download | norflash0 | 0x00141000 | 0x000af000 |
[I/FAL] | bootloader | norflash0 | 0x001f0000 | 0x0000f000 |
[I/FAL] | rdp | norflash0 | 0x001ff000 | 0x00001000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.2.0) initialize success.
[Flash] (packages/EasyFlash/src/ef_env.c:152) ENV start address is 0x00000000, size is 4096 bytes.
[Flash] (packages/EasyFlash/src/ef_env.c:821) Calculate ENV CRC32 number is 0xCF40710A.
[Flash] (packages/EasyFlash/src/ef_env.c:833) Verify ENV CRC32 result is OK.
[Flash] EasyFlash V3.2.3 is initialize success.
[Flash] You can get the latest version on .
build time: Dec 19 2019 11:19:44
Hello RT-Thread!
[Flash] (packages/EasyFlash/src/ef_env.c:152) ENV start address is 0x00000000, size is 4096 bytes.
[Flash] (packages/EasyFlash/src/ef_env.c:821) Calculate ENV CRC32 number is 0xCF40710A.
[Flash] (packages/EasyFlash/src/ef_env.c:833) Verify ENV CRC32 result is OK.
[Flash] EasyFlash V3.2.3 is initialize success.
[Flash] You can get the latest version on .
ROM:[V0.1]
FLASHRATE:4
BOOT TYPE:0 XTAL:40000000
IMG1 DATA[1128:10002000]
IMG1 ENTRY[800052d:100021ef]
IMG1 ENTER
CHIPID[000000ff]
read_mode idx:0, flash_speed idx:0
calibration_result:[1:9:9][5:d]
calibration_result:[2:13:7][1:d]
calibration_result:[3:3:3][1:3]
calibration_ok:[2:13:7]
FLASH CALIB[NEW OK]
OTA2 ADDR[81f0000]
OTAx SELE[fffffffe]
OTA2 USE
OTA2 SIGN[35393138:31313738]
IMG2 DATA[0x81fa806:252:0x10005000]
IMG2 SIGN[RTKWin(10005008)]
IMG2 ENTRY[0x10005000:0x81f87a5]
[I/STARTUP] ===== Enter Bootloader ====

System_Init1
[I/STARTUP] boot reason: 0

[I/BOOT] Hello RT-Thread!

[D/FAL] (fal_flash_init:63) Flash device | norflash0 | addr: 0x00000000 | len: 0x00200000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | app | norflash0 | 0x0000b000 | 0x00135000 |
[I/FAL] | env | norflash0 | 0x00140000 | 0x00001000 |
[I/FAL] | download | norflash0 | 0x00141000 | 0x000af000 |
[I/FAL] | bootloader | norflash0 | 0x001f0000 | 0x0000f000 |
[I/FAL] | rdp | norflash0 | 0x001ff000 | 0x00001000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.2.0) initialize success.
[I/OTA] RT-Thread OTA package(V0.2.1) initialize success.
[E/OTA] (part_fw_hash_verify:265) Verify firmware hash(calc.hash: 7f2538c4 != hdr.hash: dfbf72a4) failed on partition 'bootloader'.
[E/OTA] (get_fw_hdr:150) Get firmware header occur CRC32(calc.crc: 17159786 != hdr.info_crc32: b1b8f9af) error on 'download' partition!
[I/OTA] check upgrade...
[E/OTA] (get_fw_hdr:150) Get firmware header occur CRC32(calc.crc: 17159786 != hdr.info_crc32: b1b8f9af) error on 'download' partition!
[E/OTA] (rt_ota_check_upgrade:464) Get OTA download partition firmware header failed!
[I/OTA] No firmware upgrade!
[I/OTA] Verify 'app' partition(fw ver: 1.2.4, timestamp: 1576754488) success.
[I/BOOT] Run application
===== Enter Image 2 ====
System_Init1
OSC8M: 8390004
boot reason: 0
System_Init2

\ | /
- RT - Thread Operating System
/ | \ 3.1.1 build Dec 19 2019
2006 - 2018 Copyright by rt-thread team
lwIP-2.0.2 initialized!

LDO Mode, BD_Info: 0

LDO Mode, BD_Info: 0
i2c_idx:0
[I/SAL_SOC] Socket Abstraction Layer initialize success.
[start_value]: 1
SPI raw mode init
[I/WLAN.dev] wlan init success
[I/WLAN.lwip] eth device init ok name:w0
[I/WLAN.dev] wlan init success
[I/WLAN.lwip] eth device init ok name:w1
[D/FAL] (fal_flash_init:63) Flash device | norflash0 | addr: 0x00000000 | len: 0x00200000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | app | norflash0 | 0x0000b000 | 0x00135000 |
[I/FAL] | env | norflash0 | 0x00140000 | 0x00001000 |
[I/FAL] | download | norflash0 | 0x00141000 | 0x000af000 |
[I/FAL] | bootloader | norflash0 | 0x001f0000 | 0x0000f000 |
[I/FAL] | rdp | norflash0 | 0x001ff000 | 0x00001000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.2.0) initialize success.
[Flash] (packages/EasyFlash/src/ef_env.c:152) ENV start address is 0x00000000, size is 4096 bytes.
[Flash] (packages/EasyFlash/src/ef_env.c:821) Calculate ENV CRC32 number is 0xCF40710A.
[Flash] (packages/EasyFlash/src/ef_env.c:833) Verify ENV CRC32 result is OK.
[Flash] EasyFlash V3.2.3 is initialize success.
[Flash] You can get the latest version on .


Mac:88:97:46:07:c7:e7
rw007 sn: [rw007746978800e7c7]
rw007 ver: [1.2.9-72a55281-28908]

build time: Dec 19 2019 11:19:44
Hello RT-Thread!
[Flash] (packages/EasyFlash/src/ef_env.c:152) ENV start address is 0x00000000, size is 4096 bytes.
[Flash] (packages/EasyFlash/src/ef_env.c:821) Calculate ENV CRC32 number is 0xCF40710A.
[Flash] (packages/EasyFlash/src/ef_env.c:833) Verify ENV CRC32 result is OK.
[Flash] EasyFlash V3.2.3 is initialize success.
[Flash] You can get the latest version on .
msh />

关注下,楼主问题解决了吗?我也要用spi模式 ,卡在初始化了。。。

flash 程序屏蔽了,但是芯片还没拆下,
驱动时最新的

/*
* COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2014-07-31 aozima the first version
* 2014-09-18 aozima update command & response.
* 2017-07-28 armink fix auto reconnect feature
* 2018-12-24 zyh porting rw007 from rw009
* 2019-02-25 zyh porting rw007 to wlan
* 2020-02-28 shaoguoji add spi transfer retry
*/

国际哥 发表于 2020-3-3 18:21
最新的007软件包已经修复了这个问题,楼主可以更新试一下。


f407 使用rw007时,发现初始化不过,能帮忙看下问题吗?https://www.rt-thread.org/qa/thread-424041-1-1.html

[td]
[table=98%,rgb(244, 244, 244)]
[tr=rgb(255, 255, 255)][td]初始化顺序[/td][td]宏接口[/td][td]描述[/td][/tr]
[tr=rgba(160, 160, 160, 0][td]1[/td][td]INIT_BOARD_EXPORT(fn)[/td][td][p=22, null, left]非常早期的初始化,此时调度器还未启动[/p][p=22, null, left]使用该宏后,fn 将属于 “board init functions”[/p][/td][/tr]
[tr=rgb(247, 247, 247)][td]2[/td][td]INIT_PREV_EXPORT(fn)[/td][td][p=22, null, left]主要是用于纯软件的初始化、没有太多依赖的函数[/p][p=22, null, left]使用该宏后,fn 将属于 “pre-initialization functions”[/p][/td][/tr]
[tr=rgba(160, 160, 160, 0][td]3[/td][td]INIT_DEVICE_EXPORT(fn)[/td][td][p=22, null, left]外设驱动初始化相关,比如网卡设备[/p][p=22, null, left]使用该宏后,fn 将属于 “device init functions”[/p][/td][/tr]
[tr=rgb(247, 247, 247)][td]4[/td][td]INIT_COMPONENT_EXPORT(fn)[/td][td][p=22, null, left]组件初始化,比如文件系统或者 LWIP[/p][p=22, null, left]使用该宏后,fn 将属于 “components init functions”[/p][/td][/tr]
[tr=rgba(160, 160, 160, 0][td]5[/td][td]INIT_ENV_EXPORT(fn)[/td][td][p=22, null, left]系统环境初始化,比如挂载文件系统[/p][p=22, null, left]使用该宏后,fn 将属于 “enviroment init functions”[/p][/td][/tr]
[tr=rgb(247, 247, 247)][td]6[/td][td]INIT_APP_EXPORT(fn)[/td][td][p=22, null, left]应用初始化,比如 GUI 应用[/p][p=22, null, left]使用该宏后,fn 将属于 “application init functions”[/p][/td][/tr]
[/table]
可以根据上面的加载顺序,加载自己的程序就行了

需要自己写对应的转换函数,例子如下

typedef struct {
char name[16];
} Hometown;

typedef struct {
uint8_t id;
double weight;
uint8_t score[8];
char name[10];
Hometown hometown;
} Student;

/**
* Student JSON object to structure object
*
* @param json_obj JSON object
*
* @return structure object
*/
static void *json_to_struct(cJSON* json_obj) {
/* create Student structure object */
s2j_create_struct_obj(struct_student, Student);

/* deserialize data to Student structure object. */
s2j_struct_get_basic_element(struct_student, json_obj, int, id);
s2j_struct_get_array_element(struct_student, json_obj, int, score);
s2j_struct_get_basic_element(struct_student, json_obj, string, name);
s2j_struct_get_basic_element(struct_student, json_obj, double, weight);

/* deserialize data to Student.Hometown structure object. */
s2j_struct_get_struct_element(struct_hometown, struct_student, json_hometown, json_obj, Hometown, hometown);
s2j_struct_get_basic_element(struct_hometown, json_hometown, string, name);

/* return Student structure object pointer */
return struct_student;
}

/**
* Student structure object to JSON object
*
* @param struct_obj structure object
*
* @param JSON object
*/
static cJSON *struct_to_json(void* struct_obj) {
Student *struct_student = (Student *)struct_obj;

/* create Student JSON object */
s2j_create_json_obj(json_student);

/* serialize data to Student JSON object. */
s2j_json_set_basic_element(json_student, struct_student, int, id);
s2j_json_set_basic_element(json_student, struct_student, double, weight);
s2j_json_set_array_element(json_student, struct_student, int, score, 8);
s2j_json_set_basic_element(json_student, struct_student, string, name);

/* serialize data to Student.Hometown JSON object. */
s2j_json_set_struct_element(json_hometown, json_student, struct_hometown, struct_student, Hometown, hometown);
s2j_json_set_basic_element(json_hometown, struct_hometown, string, name);

/* return Student JSON object pointer */
return json_student;
}

我也是现学现卖,只知道littlefs 挂载到MTD,elmfat挂载到block,文档上 这里只给了这张图

U8G2不熟悉没用过,中文这快,要保证C代码和字库的编码统一,你C文件是用UTF-8格式的话,编译器自动就按照UTF-8格式的来处理中文,所以字库就要是UTF-8格式的 ,如果想用GB2312,要保证你的C文件是GB2312格式的,并且字库也要是GB2312的就可以了

elm是挂载到Block Device的,不用再转换成MTD设备

madfish 发表于 2020-3-21 12:29
你文件系统挂载到block设备上还是MTD设备上?


msh />list_device
device type ref count
-------- -------------------- ----------
factory MTD Device 1
littlefs MTD Device 1
w25q128 Block Device 0
spi20 SPI Device 0
e0 Network Interface 0
spi2 SPI Bus 0
uart5 Character Device 1
uart3 Character Device 1
uart1 Character Device 2

还需要添加spi_flash_init.c文件,bsp目录下有,需要根据实际情况修改下 实际内容如下

/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-11-27 SummerGift add spi flash port file
*/

#include
#include
#include "spi_flash.h"
#include "spi_flash_sfud.h"
#include "drv_spi.h"

#if defined(BSP_USING_SPI_FLASH)
static int rt_hw_spi_flash_init(void)
{
__HAL_RCC_GPIOI_CLK_ENABLE();
//rt_pin_mode(GET_PIN(I,0), PIN_MODE_OUTPUT);
rt_hw_spi_device_attach("spi2", "spi20", GPIOI, GPIO_PIN_0);

if (RT_NULL == rt_sfud_flash_probe(FAL_USING_NOR_FLASH_DEV_NAME, "spi20"))
{
return -RT_ERROR;
};

return RT_EOK;
}
INIT_COMPONENT_EXPORT(rt_hw_spi_flash_init);
#endif

回到
顶部

发布
问题

投诉
建议