5 ART-PI 在运行Touchgfx时如果打开wifi就在初始化时有一段时间乱码

发布于 2021-02-03 10:14:37    浏览:256

首先说明一下问题,在ART-Pi上运行好Touchgfx的官方例程后,若不开启AP6212A,屏幕显示正常,若开启AP6212A发现屏幕在初始化时会发生乱码。经过检查项目的软件包时,发现会有一个Fal被使能,这时在终端可以看到以下数据
[I/SFUD] Probe SPI flash norflash0 by SPI device spi10 success.
[D/FAL] (fal_flash_init:63) Flash device | norflash0 | addr: 0x00000000 | len: 0x01000000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | wifi_image | norflash0 | 0x00000000 | 0x00080000 |
[I/FAL] | bt_image | norflash0 | 0x00080000 | 0x00080000 |
[I/FAL] | download | norflash0 | 0x00100000 | 0x00200000 |
[I/FAL] | easyflash | norflash0 | 0x00300000 | 0x00100000 |
[I/FAL] | filesystem | norflash0 | 0x00400000 | 0x00c00000 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.5.0) initialize success.

发现norflash被分区,接着我又开始分析具体是什么情况引起的初始化时有一段时间的乱码,于是我想到了,TouchGfx会不会使用了Flash靠前的部分,于是就找到了fal_cfg.h文件,打开后可以看到:
}
/ ==================== Partition Configuration ======================== /

ifdef FAL_PART_HAS_TABLE_CFG

define FAL_PART_TABLE \

{ \

{FAL_PART_MAGIC_WORD, "wifi_image", NOR_FLASH_DEV_NAME,           0,     512*1024, 0}, \
{FAL_PART_MAGIC_WORD, "bt_image",   NOR_FLASH_DEV_NAME,    512*1024,     512*1024, 0}, \
{FAL_PART_MAGIC_WORD, "download",   NOR_FLASH_DEV_NAME,   1024*1024,  2*1024*1024, 0}, \
{FAL_PART_MAGIC_WORD, "easyflash",  NOR_FLASH_DEV_NAME, 3*1024*1024,  1*1024*1024, 0}, \
{FAL_PART_MAGIC_WORD, "filesystem", NOR_FLASH_DEV_NAME, 4*1024*1024, 12*1024*1024, 0}, \

}

endif / FAL_PART_HAS_TABLE_CFG /

可以看到第一个分区是关于wifi的,于是就将flash全部向后移动1024,果然屏幕不会有一段时间乱码了,但是又出现了一个新的报错(最后一行):
[I/SFUD] Probe SPI flash norflash0 by SPI device spi10 success.
[D/FAL] (fal_flash_init:63) Flash device | norflash0 | addr: 0x00000000 | len: 0x01000000 | blk_size: 0x00001000 |initialized finish.
[I/FAL] ==================== FAL partition table ====================
[I/FAL] | name | flash_dev | offset | length |
[I/FAL] -------------------------------------------------------------
[I/FAL] | wifi_image | norflash0 | 0x00000400 | 0x00080400 |
[I/FAL] | bt_image | norflash0 | 0x00080400 | 0x00080400 |
[I/FAL] | download | norflash0 | 0x00100400 | 0x00200400 |
[I/FAL] | easyflash | norflash0 | 0x00300400 | 0x00100400 |
[I/FAL] | filesystem | norflash0 | 0x00400400 | 0x00c00400 |
[I/FAL] =============================================================
[I/FAL] RT-Thread Flash Abstraction Layer (V0.5.0) initialize success.
[I/at.clnt] AT client(V1.3.0) on device uart6 initialize success.
[D/at.dev.ec20] network interface device(4G) set up status.
[I/FAL] The FAL MTD NOR device (filesystem) created successfully
../packages/littlefs-latest/lfs.c:1071:error: Corrupted dir pair at {0x0, 0x1}
[W/app.filesystem] mount to '/flash' failed! try to mkfs filesyst夗夗眄眄?$
[I/touch] rt_touch init success
[D/at.dev.[ec20] startI/OTA] RT init -4G device.Thread OTA
package(V0.2.3) initialize success.
msh />[E/WLAN] Wi-Fi image was NOT found on wifi_image partition

我第一次碰到这个报错的时候已经懵了,于是就开始查找源头,在libraries->drivers->drv_wlan.c 可以看到第171行函数, / initialize fal /

fal_init();
partition = fal_partition_find(WIFI_IMAGE_PARTITION_NAME);

首先进行fal初始化,其次是fal_partition_find(WIFI_IMAGE_PARTITION_NAME);查找分区函数。接着就会执行一下函数,原来在初始化之前会寻找此分区,但是我不清楚这个分区明明已经定义仅仅是向后移动了一部分不知为何就是找不到,所以还请大佬帮帮忙。

if (rt_ota_part_fw_verify(partition) >= 0)
{
    /* initialize low level wifi(ap6212) library */
    wifi_hw_init();

    /* waiting for sdio bus stability */
    rt_thread_delay(WIFI_INIT_WAIT_TIME);

    /* set wifi work mode */
    rt_wlan_set_mode(RT_WLAN_DEVICE_STA_NAME, RT_WLAN_STATION);
    /* NEED TODO !!! */
    /* rt_wlan_set_mode(RT_WLAN_DEVICE_AP_NAME, RT_WLAN_AP); */

    init_flag = 1;
}
else
{
    LOG_E("Wi-Fi image was NOT found on %s partition!", WIFI_IMAGE_PARTITION_NAME);
}

查看更多

whj467467222
whj467467222 认证专家 2021-02-03
This guy hasn't written anything yet

可以先尝试在一个没有 touchgfx 的工程上去验证 FAL 的功能是否正常, 偏移地址改到 4096 试一试。

FAL 提供了很多的 终端测试命令

fal probe

fal write

fal read

先测试一下这些是否正常。

2 个回答
XYX
XYX 2021-05-24
This guy hasn't written anything yet
bool TouchGFXHAL::blockCopy(void* RESTRICT dest, const void* RESTRICT src, uint32_t numBytes)

咨询一下,Touch GFX中的这个函数在RTT中什么时候调用?具体在哪里调用?能不能把它调用的顺序放在SD卡挂载后?

撰写答案

请登录后再发布答案,点击登录
关注者
0
被浏览
256

发布
问题

分享
好友

手机
浏览

扫码手机浏览