Skip to main content
Visitor II
October 16, 2024
Question

interfacing HC-SR04 Ultrasonic sensor to STM32MP135-DK

  • October 16, 2024
  • 2 replies
  • 1245 views

Hi All,

i am using STM32MP135-DK kit & i want to interface the ultrasonic sensor HC-SR04.

from user space i have tried to make gpio toggle at 10uSec ON/OFF which will be trigger signal for sensor but what i  observe in the trigger output pin is not toggling at same rate what i made it in bash script. 

can someone help me to resolve this or if we have ready solution available i can utilize it instead of reinventing it again.

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    October 17, 2024

    Hi @prabhu1985 

    with a OS like Linux, it is quite impossible to control so short time using GPIOs framework.

    I think you should use timers to accurately generate the pulse and measure the feedback pulse delay.

    https://wiki.st.com/stm32mpu/wiki/TIM_internal_peripheral

    Maybe some Linux drivers already exist for the HC-SR04 and could be tried/ported on STM32MP135.

     

    Regards.

     

    ST Employee
    October 17, 2024

    Hi @prabhu1985 

     

    This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

     

    Regards,

    Billy