当前位置:网站首页>CMT2380F32模块开发6-flash例程
CMT2380F32模块开发6-flash例程
2022-08-11 05:24:00 【andylauren】
本设备包含一颗 32kByte 容量的 FLASH 存储器,共划分为 64 个 Sector,每个 Sector 容量为 512Byte。本模块支持对该存储器的擦除、编程以及读取操作。此外,本模块支持对 FLASH 存储器擦写的保护,以及控制寄存器的写保护。
如果是初学者不建议使用这个做离线数据保存,还是老老实实外加eeprom吧,除非你明确的直到你的代码用了哪些flash,哪些falsh没有被使用。如果你是大神,可以使用这个功能做升级。
本样例展示FLASH的擦写功能,包括Sector擦除,字节/半字/字写功能。
en_result_t FlashWriteTest(void)
{
en_result_t enResult = Error;
uint32_t u32Addr = 0x3ff0;
uint8_t u8Data = 0x5a;
uint16_t u16Data = 0x5a5a;
uint32_t u32Data = 0x5a5a5a5a;
Flash_Init(FlashInt, 0);
Flash_SectorErase(u32Addr);
enResult = Flash_WriteByte(u32Addr, u8Data);
if (Ok == enResult) {
if (*((volatile uint8_t*)u32Addr) == u8Data) {
enResult = Ok;
} else {
return enResult;
}
} else {
enResult = Error;
return enResult;
}
u32Addr += 2;
enResult = Flash_WriteHalfWord(u32Addr, u16Data);
if (Ok == enResult) {
if (*((volatile uint16_t*)u32Addr) == u16Data) {
enResult = Ok;
} else {
return enResult;
}
} else {
return enResult;
}
u32Addr += 2;
enResult = Flash_WriteWord(u32Addr, u32Data);
if (Ok == enResult) {
if (*((volatile uint32_t*)u32Addr) == u32Data) {
enResult = Ok;
} else {
return enResult;
}
} else {
return enResult;
}
return enResult;
}
这是它的测试代码,就是对0x3ff0地址进行字节/半字/字 擦写读过程。读数据是通过指针强制类型转换进行的。
这个例程只能通过打断看,查看FlashWriteTest的返回结果。
单独跑这个程序都能成功,要是自己写的程序就不能保证了。
边栏推荐
- >>技术应用:用于 REST API 开发和测试的 10 大工具
- SCNet: Semantic Consistency Networks for 3D Object Detection
- 我心仪的数据集—目标检测为主
- Use regex to verify whether the file name is legal
- Toward a Unified Model
- 梅科尔工作室-第四次PR培训笔记(字幕和标题动画,关键帧动画和声音处理)
- 通过字符设备虚拟文件系统实现kernel和userspace数据交换(基于kernel 5.8测试通过)
- GBase 8a MPP Cluster产品支撑的平台
- Mei cole studios - fifth training DjangoWeb application framework + MySQL database
- Safety helmet identification system - escort for safe production
猜你喜欢
Reconstruction and Synthesis of Lidar Point Clouds of Spray
Mei cole studios - sixth DjangoWeb application framework + MySQL database training
关于mmdetection框架实用小工具说明
CVPR2022——Not All Points Are Equal : IA-SSD
第七届集美大学程序设计竞赛(个人赛)题解
跳转到微信小程序方法
Waymo数据集使用介绍(waymo-open-dataset)
从概念认识AI
LAGRANGIAN FLUID SIMULATION WITH CONTINUOUS CONVOLUTIONS
梅科尔工作室-DjangoWeb 应用框架+MySQL数据库第五次培训
随机推荐
Maykel Studio - Django Web Application Framework + MySQL Database Third Training
SCNet: Semantic Consistency Networks for 3D Object Detection
Hardhat Recognition System - Solving Regulatory Conundrums
关于mmdetection框架实用小工具说明
Maykle Studio - HarmonyOS Application Development Third Training
LAGRANGIAN FLUID SIMULATION WITH CONTINUOUS CONVOLUTIONS
解决jupyter中import torch出错问题
目标检测思维导图
梅科尔工作室-华为云ModelArts第二次培训
CVPR2022——Not All Points Are Equal : IA-SSD
华为adb wifi调试断线问题解决
Maykle Studio - HarmonyOS Application Development Fourth Training
Hard hat identification
Node-1.高性能服务器
HTTP缓存机制详解
Safety helmet recognition - construction safety "regulator"
The selection points you need to know about the helmet identification system
weex入门踩坑
Node-3.构建Web应用(一)
目标检测学习目录(持续更新)