Hi,
I am new in Device tree concept. I am trying to operate a buzzer via PWM.
In our board, the buzzer is connected in GPIO 3.
I changed a segment in file nrf52dk_nrf52832-pinctrl.dtsi as follow:
( port changed from 17 to 3)
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 3)>;
nordic,invert;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 3)>;
low-power-enable;
};
};
The buzzer make a beep sound using this code:
static const struct pwm_dt_spec pwm_led0 = PWM_DT_SPEC_GET(DT_ALIAS(pwm_led0));
ret = pwm_set_dt(&pwm_led0, period, period/2);
I know its not the correct way to change the board dtsi files...
1) Can you send me an overlay file for buzzer setting the port 3 ?
2) I also can't understand how/where to attach this overlay file ... ?
unrelated issue
3) I am trying to stop the buzzer using
ret = pwm_set_dt(&pwm_led0, 0, 0);
or
pwm_set_pulse_dt(&pwm_led0, 0);
the buzzer stops, but I still hear very weak humming sound and I notice a high current consumption.
How can I fix this problem ?
Alon