Skip to main content
This topic has been closed for replies.
BAl K.1
BAl K.1Best answer
Associate III
Dec 16, 2022 10:24 AM UTC

thank you for your response sir, i solved it by using manual function in this reference (363) PZEM-004T + STM32/Cortex измерение �?нергии + в�?�?кое - YouTube

6 replies

Tesla DeLorean
Guru
Dec 14, 2022 5:13 AM UTC

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.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
BAl K.1
BAl K.1Author
Associate III
Dec 14, 2022 5:24 AM UTC

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

Javier1
Principal
Dec 14, 2022 8:15 AM UTC

provide that and how you're wiring this all up

hit me up in https://www.linkedin.com/in/javiermuñoz/
Javier1
Principal
Dec 14, 2022 8:17 AM UTC

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

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=video&cd=&cad=rja&uact=8&ved=2ahUKEwiDqMDo1vj7AhVFTaQEHcPMAzQQtwJ6BAgJEAI&url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dl5msGz2tZP0&usg=AOvVaw0T0AcJVZ4WIco1h8sbOXQr

hit me up in https://www.linkedin.com/in/javiermuñoz/
BAl K.1
BAl K.1AuthorBest answer
Associate III
Dec 16, 2022 10:24 AM UTC

thank you for your response sir, i solved it by using manual function in this reference (363) PZEM-004T + STM32/Cortex измерение �?нергии + в�?�?кое - YouTube

Javier1
Principal
Dec 16, 2022 11:18 AM UTC

tick yourself as best answer then

hit me up in https://www.linkedin.com/in/javiermuñoz/