cancel
Showing results for 
Search instead for 
Did you mean: 

interfacing HC-SR04 Ultrasonic sensor to STM32MP135-DK

prabhu1985
Associate

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.

2 REPLIES 2
PatrickF
ST Employee

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.

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Billy OWEN
ST Employee

Hi @prabhu1985 

 

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

 

Regards,

Billy