完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我想用QSPI FLASH 作OTA,选用的是W25Q64,现在对QSPI的读写都正常,但是把QSPI 映射成内存模式,一对 0x9000000UL 进行读,就进入HardFault_Handler, 下面是我配置映射的代码,哪位大侠能帮看看有什么问题没有我芯片是用的STM32H750VB 用的STM32CUBE
static unsigned int QSPI_EnableMemoryMappedMode(QSPI_HandleTypeDef *QSPIHandle) { QSPI_CommandTypeDef s_command; QSPI_MemoryMappedTypeDef s_mem_mapped_cfg; // Configure the command for the read instruction s_command.InstructionMode = QSPI_INSTRUCTION_1_LINE; s_command.Instruction = QUAD_INOUT_FAST_READ_CMD; s_command.Address = 0; s_command.AddressMode = QSPI_ADDRESS_4_LINES; s_command.AddressSize = QSPI_ADDRESS_24_BITS; s_command.AlternateBytes = 0x00; s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS; s_command.DataMode = QSPI_DATA_4_LINES; s_command.NbData = 1; //??????? s_command.DummyCycles = 6; s_command.DdrMode = QSPI_DDR_MODE_DISABLE; s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY; s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD; // Configure the memory mapped mode s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE; s_mem_mapped_cfg.TimeOutPeriod = 0; return HAL_QSPI_MemoryMapped(QSPIHandle, s_command, s_mem_mapped_cfg); } */ static unsigned int QSPI_EnableMemoryMappedMode(QSPI_HandleTypeDef *QSPIHandle) { QSPI_CommandTypeDef s_command; QSPI_MemoryMappedTypeDef s_mem_mapped_cfg; // Configure the command for the read instruction s_command.InstructionMode = QSPI_INSTRUCTION_4_LINES; s_command.Instruction = QUAD_INOUT_FAST_READ_CMD; s_command.Address = 0; s_command.AddressMode = QSPI_ADDRESS_4_LINES; s_command.AddressSize = QSPI_ADDRESS_32_BITS; // 24 32 都试过 s_command.AlternateBytes = 0x00; s_command.AlternateByteMode = QSPI_ALTERNATE_BYTES_NONE; s_command.AlternateBytesSize = QSPI_ALTERNATE_BYTES_8_BITS; s_command.DataMode = QSPI_DATA_4_LINES; s_command.NbData = 1; //??????? s_command.DummyCycles = 6; s_command.DdrMode = QSPI_DDR_MODE_DISABLE; s_command.DdrHoldHalfCycle = QSPI_DDR_HHC_ANALOG_DELAY; s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD; // Configure the memory mapped mode s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE; s_mem_mapped_cfg.TimeOutPeriod = 0; return HAL_QSPI_MemoryMapped(QSPIHandle, s_command, s_mem_mapped_cfg); } |
|
相关推荐
1个回答
|
|
从您提供的代码段来看,设置QSPI的内存映射模式需要进行以下步骤:
1. 为QSPI命令配置结构体s_command: ``` QSPI_CommandTypeDef s_command; ``` 2. 配置QSPI命令的有关参数,如地址、数据长度、读模式等等: ``` s_command.InstructionMode = QSPI_INSTRUCTION_1_LINE; s_command.Instruction = READ_CMD; s_command.AddressMode = QSPI_ADDRESS_1_LINE; s_command.AddressSize = QSPI_ADDRESS_24_BITS; s_command.DataMode = QSPI_DATA_4_LINES; s_command.DummyCycles = 0; s_command.DdrMode = QSPI_DDR_MODE_DISABLE; s_command.SIOOMode = QSPI_SIOO_INST_EVERY_CMD; s_command.NbData = buffer_size; s_command.Address = 0x90000000UL; // 这里需要修改成您要读取的地址 // 使用QSPI发送读命令 HAL_QSPI_Command(&QSPIHandle, &s_command, HAL_QPSI_TIMEOUT_DEFAULT_VALUE); ``` 3. 配置QSPI内存映射: ``` QSPI_MemoryMappedTypeDef s_mem_mapped_cfg; s_mem_mapped_cfg.TimeOutActivation = QSPI_TIMEOUT_COUNTER_DISABLE; s_mem_mapped_cfg.TimeOutPeriod = 0; HAL_QSPI_MemoryMapped(&QSPIHandle, &s_mem_mapped_cfg); ``` 请仔细检查以上步骤是否正确设置,特别要注意地址、读模式等参数是否正确。如果仍然进入HardFault_Handler,请检查QSPI配置是否正确,如时钟配置、引脚配置等等。可能需要进一步调试并查看硬件手册和库文档以找到问题。 |
|
|
|
只有小组成员才能发言,加入小组>>
调试STM32H750的FMC总线读写PSRAM遇到的问题求解?
1645 浏览 1 评论
X-NUCLEO-IHM08M1板文档中输出电流为15Arms,15Arms是怎么得出来的呢?
1564 浏览 1 评论
992 浏览 2 评论
STM32F030F4 HSI时钟温度测试过不去是怎么回事?
691 浏览 2 评论
ST25R3916能否对ISO15693的标签芯片进行分区域写密码?
1610 浏览 2 评论
1870浏览 9评论
STM32仿真器是选择ST-LINK还是选择J-LINK?各有什么优势啊?
655浏览 4评论
STM32F0_TIM2输出pwm2后OLED变暗或者系统重启是怎么回事?
525浏览 3评论
541浏览 3评论
stm32cubemx生成mdk-arm v4项目文件无法打开是什么原因导致的?
514浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-26 20:19 , Processed in 0.858263 second(s), Total 47, Slave 41 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号