WRITING TO FLASH WITH UART
Hi everyone,
I can write to flash of STM32F103, max value of uint32 variable 4294967294.
It is possible to write when you write it to flash directly.
But I want to write it to flash with uart receiving. But when I put the rows (which is writed Bold in codes) for receiving uart then it gives different value.
I am sharing my codes below. Could you please check it where or what is wrong with my codes?
Thanks and regards
uint32_t RxData;
uint32_t TxData;
char UartRxData[10]="4294967294";
char data[10];
/* Initialize all configured peripherals */
MX_GPIO_Init();
MX_USART2_UART_Init();
/* USER CODE BEGIN 2 */
Flash_Write( 0x08007C00, 4294967294);
HAL_Delay(50);
/* USER CODE END 2 */
/* Infinite loop */
/* USER CODE BEGIN WHILE */
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_UART_Receive_IT(&huart2, (uint8_t*)&UartRxData, strlen(UartRxData)); //activate UART receive interrupt every time
unsigned long val = atoi(UartRxData);
Flash_Write(0x08007C00, val);
RxData = Flash_Read(0x08007C00);
sprintf(data, " %lu", RxData);
HAL_UART_Transmit(&huart2, (uint8_t*)&data, strlen(data), 1000);
HAL_Delay(50);
}
/* USER CODE END 3 */
}
