Toggle navigation
首页
问答
文章
积分商城
专家
专区
更多专区...
文档中心
返回主站
搜索
提问
会员
中心
登录
注册
FAL
flash
ota
OTA 片上FLASH擦除失败
发布于 2020-07-03 11:02:25 浏览:1377
订阅该版
   ```c #define RT_APP_PART_ADDR 0x08010000 extern const struct fal_flash_dev stm32_onchip_flash; /* flash device table */ #define FAL_FLASH_DEV_TABLE \ { \ &stm32_onchip_flash, \ } /* ====================== Partition Configuration ========================== */ #ifdef FAL_PART_HAS_TABLE_CFG /* partition table */ #define FAL_PART_TABLE \ { \ {FAL_PART_MAGIC_WROD, "app", "onchip_flash", 64* 1024, 512 * 1024, 0}, \ {FAL_PART_MAGIC_WROD, "download", "onchip_flash", 576* 1024, 384 * 1024, 0}, \ } #endif /* FAL_PART_HAS_TABLE_CFG */ #endif /* _FAL_CFG_H_ */ ``` 后发现是我使用了硬件SPI的u8g2,导致片内flash擦写失败,提示:[E/FAL] (fal_partition_erase:510) Partition erase error! Flash device(onchip_flash) erase error! 去掉u8g2线程初始化就正常擦写,后来新建工程只添加硬件SPI 和FAL,还是同样的状况,使用的是ST官方的L496ZG开发板,rtt4.0.2,最新软件包 u8g2程序: ``` #include "menu.h" struct menu_entry_type { const uint8_t *font; uint16_t icon; const char *name; }; struct menu_state { int16_t menu_start; /* in pixel */ int16_t frame_position; /* in pixel */ uint8_t position; /* position, array index */ }; /* Icon configuration Width and height must match the icon font size GAP: Space between the icons BGAP: Gap between the display border and the cursor. */ #define ICON_WIDTH 32 #define ICON_HEIGHT 32 #define ICON_GAP 4 #define ICON_BGAP 16 #define ICON_Y 32+ ICON_GAP static struct menu_entry_type menu_entry_list[] = { { u8g2_font_open_iconic_play_4x_t, 77,"音乐播放" }, { u8g2_font_open_iconic_mime_4x_t, 64,"收音机" }, { u8g2_font_open_iconic_embedded_4x_t, 70,"心率检测" }, { u8g2_font_open_iconic_embedded_4x_t, 74,"蓝牙连接" }, { u8g2_font_open_iconic_embedded_4x_t, 66,"关于" }, { NULL, 0, NULL } }; static void draw(struct menu_state *state) { int16_t x; uint8_t i; x = state->menu_start; i = 0; while( menu_entry_list[i].icon > 0 ) { if ( x >= -ICON_WIDTH && x < u8g2.getDisplayWidth() ) { u8g2.setFont(menu_entry_list[i].font); u8g2.drawGlyph(x, ICON_Y, menu_entry_list[i].icon ); } i++; x += ICON_WIDTH + ICON_GAP; } u8g2.drawFrame(state->frame_position-1, ICON_Y-ICON_HEIGHT-1, ICON_WIDTH+2, ICON_WIDTH+2); u8g2.drawFrame(state->frame_position-2, ICON_Y-ICON_HEIGHT-2, ICON_WIDTH+4, ICON_WIDTH+4); u8g2.drawFrame(state->frame_position-3, ICON_Y-ICON_HEIGHT-3, ICON_WIDTH+6, ICON_WIDTH+6); } static void to_right(struct menu_state *state) { if ( menu_entry_list[state->position+1].font != NULL ) { if ( (int16_t)state->frame_position+ 2*(int16_t)ICON_WIDTH + (int16_t)ICON_BGAP < (int16_t)u8g2.getDisplayWidth() ) { state->position++; state->frame_position += ICON_WIDTH + (int16_t)ICON_GAP; } else { state->position++; state->frame_position = (int16_t)u8g2.getDisplayWidth() - (int16_t)ICON_WIDTH - (int16_t)ICON_BGAP; state->menu_start = state->frame_position - state->position*((int16_t)ICON_WIDTH + (int16_t)ICON_GAP); } } } static void to_left(struct menu_state *state) { if ( state->position > 0 ) { if ( (int16_t)state->frame_position >= (int16_t)ICON_BGAP+(int16_t)ICON_WIDTH+ (int16_t)ICON_GAP ) { state->position--; state->frame_position -= ICON_WIDTH + (int16_t)ICON_GAP; } else { state->position--; state->frame_position = ICON_BGAP; state->menu_start = state->frame_position - state->position*((int16_t)ICON_WIDTH + (int16_t)ICON_GAP); } } } static uint8_t towards_int16(int16_t *current, int16_t dest) { if ( *current < dest ) { (*current)++; return 1; } else if ( *current > dest ) { (*current)--; return 1; } return 0; } static uint8_t towards(struct menu_state *current, struct menu_state *destination) { uint8_t r = 0; r |= towards_int16( &(current->frame_position), destination->frame_position); r |= towards_int16( &(current->frame_position), destination->frame_position); r |= towards_int16( &(current->menu_start), destination->menu_start); r |= towards_int16( &(current->menu_start), destination->menu_start); return r; } static struct menu_state current_state = { ICON_BGAP, ICON_BGAP, 0 }; static struct menu_state destination_state = { ICON_BGAP, ICON_BGAP, 0 }; static void music_entry(void) { ... } static void fm_entry(void) { ... } static void health_entry(void) { ... } static void bluetooth_entry(void) { ... } static void menu_entry(void *parameter) { u8g2.begin(/*Select=*/ U8G2_PIN_SELECT, /*Right/Next=*/ U8G2_PIN_RIGHT, /*Left/Prev=*/ U8G2_PIN_LEFT, /*Up=*/ U8G2_PIN_UP, /*Down=*/ U8G2_PIN_DOWN, /*Home/Cancel=*/ U8G2_PIN_HOME); u8g2.enableUTF8Print(); u8g2.setFont(u8g2_font_wqy14_t_gb2312); u8g2.setContrast(128); u8g2.clearBuffer(); u8g2.setCursor(30, 20); u8g2.print("欢迎使用"); u8g2.sendBuffer(); rt_thread_mdelay(5000); u8g2.clearBuffer(); u8g2.setCursor(30, 20); u8g2.print("初始化中"); u8g2.setCursor(0, 50); u8g2.print("请耐心等待系统启动"); u8g2.sendBuffer(); rt_sem_take(init_sem, RT_WAITING_FOREVER); while(1) { int8_t event; do { u8g2.clearBuffer(); u8g2.setFont(u8g2_font_6x12_tr); draw(¤t_state); u8g2.setFont(u8g2_font_wqy14_t_gb2312); u8g2.setCursor((u8g2.getDisplayWidth()-u8g2.getUTF8Width(menu_entry_list[destination_state.position].name))/2,u8g2.getDisplayHeight()-5); u8g2.print(menu_entry_list[destination_state.position].name); u8g2.sendBuffer(); rt_thread_mdelay(10); event = u8g2.getMenuEvent(); if ( event == U8X8_MSG_GPIO_MENU_NEXT ) to_right(&destination_state); if ( event == U8X8_MSG_GPIO_MENU_PREV ) to_left(&destination_state); if ( event == U8X8_MSG_GPIO_MENU_UP ) rt_device_write(serial, 0, "AT+CE\r\n", sizeof("AT+CE\r\n")); if ( event == U8X8_MSG_GPIO_MENU_DOWN ) rt_device_write(serial, 0, "AT+CF\r\n", sizeof("AT+CF\r\n")); if ( event == U8X8_MSG_GPIO_MENU_SELECT ) { if ( destination_state.position == 0 ) { music_entry(); } else if ( destination_state.position == 1 ) fm_entry(); else if ( destination_state.position == 2 ) health_entry(); else if ( destination_state.position == 3 ) bluetooth_entry(); else if ( destination_state.position == 4 ) { u8g2.userInterfaceMessage(menu_entry_list[destination_state.position].name,"", "", " Ok "); } else { rt_kprintf ("position : %10d\r\n",destination_state.position); } } } while ( towards(¤t_state, &destination_state) ); rt_thread_mdelay(10); } } int rt_hw_menu_port(void) { menu = rt_thread_create("menu", menu_entry, RT_NULL, 2048, 3, 10); if (menu != RT_NULL) rt_thread_startup(menu); return 0; } INIT_APP_EXPORT(rt_hw_menu_port); MSH_CMD_EXPORT(rt_hw_menu_port,1); ```
查看更多
4
个回答
默认排序
按发布时间排序
小小李sunny
2020-07-03
这家伙很懒,什么也没写!
你的BootLoader设置的download区大小跟程序里设置好像不太一样。 BootLoader里是0x70000,程序里是0x60000。 把这两个地方改一致试试看能不能解决你的问题吧。
红枫
认证专家
2020-07-03
这家伙很懒,什么也没写!
用的那款mcu
打盹的消防车
2020-07-06
忙着打盹...
找到问题原因了,使用硬件SPI 的u8g2之后flash无法擦写,注释掉u8g2初始化线程就正常擦写
xp187oo
2020-07-06
这家伙很懒,什么也没写!
你的问题修复了吗?我和你遇到类似的问题了。
撰写答案
登录
注册新账号
关注者
2
被浏览
1.4k
关于作者
打盹的消防车
忙着打盹...
提问
15
回答
30
被采纳
1
关注TA
发私信
相关问题
1
关于FAL移植
2
添加fal软件包之后编译出现错误,求助!
3
关于easyflash4.0的写入和读取norflash一些疑惑咨询
4
FAL驱动移植&构建脚本问题
5
帮我看一下这样分区会不会冲突??
6
EasyFlash 4.0疑似出BUG
7
疑似FAL日志输出与DFS冲突??
8
fal软件包偏移量大于等于当前分区的大小会报错
9
为什么片内Flash总是写失败?
10
片上flash的文件系统的建立
推荐文章
1
RT-Thread应用项目汇总
2
玩转RT-Thread系列教程
3
五分钟玩转RT-Thread新社区
4
机器人操作系统 (ROS2) 和 RT-Thread 通信
5
【技术三千问】之《玩转ART-Pi》,看这篇就够了!干货汇总
6
国产MCU移植系列教程汇总,欢迎查看!
7
关于STM32H7开发板上使用SDIO接口驱动SD卡挂载文件系统的问题总结
8
STM32的“GPU”——DMA2D实例详解
9
RT-Thread隐藏的宝藏之completion
10
【ART-PI】RT-Thread 开启RTC 与 Alarm组件
最新文章
1
RS485驱动包的使用
2
当做一件事,坚持到第二十年 ——Open-SkyEye强势回归!
3
stm32f407zgt6新建工程
4
【github】rt-thread BSP 目录所有支持开发板整理展示
5
使用 D1s (RDC2022 纪念版) 连接 thingspeak
热门标签
RT-Thread Studio
串口
LWIP
SPI
Env
AT
FinSH
ART-Pi
Bootloader
CAN总线
Hardfault
文件系统
USB
DMA
RT-Thread
线程
stm32
RT-Thread Nano
SCons
MQTT
ESP8266
ota
packages_软件包
UART
rtthread
RTC
freemodbus
I2C
flash
cubemx
W5500
rt-smart
定时器
FAL
PWM
ADC
BSP
SDIO
msh
AB32VG1
Debug
C++_cpp
socket
SFUD
中断
编译报错
MicroPython
keil
LVGL
dfs
本月问答贡献
出出啊
1424
个答案
315
次被采纳
小小李sunny
1327
个答案
262
次被采纳
crystal266
490
个答案
144
次被采纳
whj467467222
1210
个答案
141
次被采纳
张世争
581
个答案
131
次被采纳
本月文章贡献
出出啊
4
篇文章
4
次点赞
小小李sunny
1
篇文章
1
次点赞
crystal266
1
篇文章
1
次点赞
whj467467222
2
篇文章
2
次点赞
张世争
1
篇文章
1
次点赞
回到
顶部
发布
问题
分享
好友
手机
浏览
扫码手机浏览
投诉
建议
回到
底部