[STM32H7] stm32h743的DFU模式下STM32CubeProgrammer写入过程卡死

[复制链接]
1242|6
 楼主| 两只袜子 发表于 2024-9-19 16:21 | 显示全部楼层 |阅读模式
如下图,在执行到HAL_FLASH_Program过程时,程序会跳入硬件错误,想了解可能是什么原因导致的,以及应该怎么解决
uint16_t MEM_If_Write_FS(uint8_t *src, uint8_t *dest, uint32_t Len){  /* USER CODE BEGIN 3 */  uint32_t i=0;  printf("MEM_If_Write_FS->src:0x%x\r\n",src);  printf("MEM_If_Write_FS->dest:0x%x\r\n",dest);  printf("MEM_If_Write_FS->Len:%d\r\n",Len);  for(i=0;i< Len; i += 4){    /*Devicevoltagerangesupposedtobe[2.7Vto3.6V],theoperationwill    bedonebybyte*/    if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD,(uint32_t)(dest+i),*(uint32_t*)(src+i))==HAL_OK){    /*Checkthewrittenvalue*/      if(*(uint32_t*)(src+i)!=*(uint32_t*)(dest+i)){      /*Flashcontentdoesn'tmatchSRAMcontent*/        printf("Flash content doesn't match SRAM content\r\n");        return(USBD_FAIL);      }    }else{    /*ErroroccurredwhilewritingdatainFlashmemory*/      printf("Error occurred while writing data in Flashmemory\r\n");      return(USBD_FAIL);    }  }  // UNUSED(src);  // UNUSED(dest);  // UNUSED(Len);  printf("MEM_If_Write_FS OK\r\n");  return (USBD_OK);  /* USER CODE END 3 */}
classroom 发表于 2024-9-20 11:15 | 显示全部楼层
硬件连接问题吧
laocuo1142 发表于 2024-9-20 11:16 | 显示全部楼层
ST-LINK驱动程序是否安装了最新的
flycamelaaa 发表于 2024-9-20 12:45 | 显示全部楼层
在STM32CubeProgrammer中,检查目标设备的选择是否正确。
检查固件文件的路径和完整性。
尝试使用不同的固件文件或版本。
powerantone 发表于 2024-9-20 16:00 | 显示全部楼层
查看STM32CubeProgrammer的日志
烟雨蒙蒙520 发表于 2024-9-29 01:24 | 显示全部楼层
可以通过FLASH_OB_Unlock()解锁选项字节,检查是否有相关的写保护位设置。
g36xcv 发表于 2024-9-30 12:30 来自手机 | 显示全部楼层
如果dest + i不符合对齐要求,会导致硬件错误。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

2122

主题

8121

帖子

11

粉丝
快速回复 在线客服 返回列表 返回顶部