Question
STM32F429I-Disco FLASH erase error
Posted on June 05, 2015 at 03:03
Wrote some code for STM32F429I-Disco that writes data in flash but it denied to work in USB receive function.
''static int8_t CDC_Receive_HS(uint8_t*Buf,uint32_t*Len)'' But it did work in main. What can it be? uint32_t sector=0; HAL_FLASH_Unlock(); static FLASH_EraseInitTypeDef erase; erase.TypeErase=FLASH_TYPEERASE_SECTORS; erase.VoltageRange=FLASH_VOLTAGE_RANGE_3; erase.Sector=(uint32_t)12; erase.NbSectors=(uint32_t)1; if(HAL_FLASHEx_Erase(&erase,§or)!=HAL_OK) {uint32_t errorcode = HAL_FLASH_GetError(); extern USBD_HandleTypeDef hUsbDeviceHS; uint8_t buf[512]; buf[0]=(uint8_t)(errorcode>>24); buf[1]=(uint8_t)(errorcode>>16); buf[2]=(uint8_t)(errorcode>>8); buf[3]=(uint8_t)errorcode; USBD_CDC_SetTxBuffer(&hUsbDeviceHS,&buf[0],4); USBD_CDC_TransmitPacket(&hUsbDeviceHS); } //HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD,(uint32_t)0x08100000,(uint32_t)0x87654321); HAL_FLASH_Lock(); I get 00 00 00 06.