Skip to main content
Explorer
June 25, 2023
Solved

How to generate timer in STM32

  • June 25, 2023
  • 1 reply
  • 1603 views

Hello! Recently I have been working on ADC, where I connect a potentiometer to a bread board and by using jumper wires I  connect it with ARM Cortex M4, STM32G491. Thankfully I have received the outputs too. But the challenge is, I have to include timer along with the voltage output. I did watch many tutorials available on internet, added few codes in it. The moment I run my code, It just shows the voltage reading not the timer reading. The code shows 0 error, I was wondering where I have mistaken, I was hoping if somebody  could help me out with this challenge. I hereby attach my code in text form. Thank you :)

    This topic has been closed for replies.
    Best answer by JTP1

    Hello. Seems that you are sending time/date to other uart than the adc result. Is it on purpose ?

    HAL_UART_Transmit(&huart3,(uint8_t*)date,sizeof(date),300);
    HAL_UART_Transmit(&huart3,(uint8_t*)time,sizeof(time),300);
    HAL_UART_Transmit(&hlpuart1,(uint8_t*)msg,strlen(msg),HAL_MAX_DELAY);

     You could also use strlen on all transmittings, not sizeof.

    1 reply

    JTP1Best answer
    Graduate II
    June 25, 2023

    Hello. Seems that you are sending time/date to other uart than the adc result. Is it on purpose ?

    HAL_UART_Transmit(&huart3,(uint8_t*)date,sizeof(date),300);
    HAL_UART_Transmit(&huart3,(uint8_t*)time,sizeof(time),300);
    HAL_UART_Transmit(&hlpuart1,(uint8_t*)msg,strlen(msg),HAL_MAX_DELAY);

     You could also use strlen on all transmittings, not sizeof.