2022-12-13 06:03 PM
I need help with using pzem 004t in stm32f405 with uart communication. i have check this source willyvamp/STM32F103C8T6-PZEM004T-DHT11: HAL STM32 (github.com) but still dont get the data form uart. please help
Solved! Go to Solution.
2022-12-16 02:24 AM
thank you for your response sir, i solved it by using manual function in this reference (363) PZEM-004T + STM32/Cortex измерение �?нергии + в�?�?кое - YouTube
2022-12-13 09:13 PM
Your code is going to be different, using a different board and different pins.
Perhaps provide that and how you're wiring this all up so some conclusion about why it is not working can be drawn.
2022-12-13 09:24 PM
thankyou for your quickc response.
yes i do, i change the uart handle and some other but still dont work. it makes me confused what is the problems
2022-12-14 12:15 AM
provide that and how you're wiring this all up
2022-12-14 12:17 AM
are you trying to programm a stm32f405 with code compiled for stm32f103?
Edit: i read the datasheet and it doesnt say anything about what Uart configurations are needed.
But looking at the github progect you shared , they are using huart2 to interface this sensor.
And these are the uart configurations you need:
static void MX_USART2_UART_Init(void)
{
/* USER CODE BEGIN USART2_Init 0 */
/* USER CODE END USART2_Init 0 */
/* USER CODE BEGIN USART2_Init 1 */
/* USER CODE END USART2_Init 1 */
huart2.Instance = USART2;
huart2.Init.BaudRate = 9600;
huart2.Init.WordLength = UART_WORDLENGTH_8B;
huart2.Init.StopBits = UART_STOPBITS_1;
huart2.Init.Parity = UART_PARITY_NONE;
huart2.Init.Mode = UART_MODE_TX_RX;
huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart2.Init.OverSampling = UART_OVERSAMPLING_16;
if (HAL_UART_Init(&huart2) != HAL_OK)
{
Error_Handler();
}
/* USER CODE BEGIN USART2_Init 2 */
/* USER CODE END USART2_Init 2 */
}
just take any tutorial and staert from there
2022-12-16 02:24 AM
thank you for your response sir, i solved it by using manual function in this reference (363) PZEM-004T + STM32/Cortex измерение �?нергии + в�?�?кое - YouTube
2022-12-16 03:18 AM
tick yourself as best answer then