How to map an active buzzer to any pin by NTF_BUZZ_PIN?

Due to using DSHOT ESC’s on my flight controller Omnibus F4 Pro I have lack of timers so my buzzer output stopped working (discussed here ).
I need to have at least a simple buzzer so I’d like to map an active buzzer to some free output using NTF_BUZZ_PIN parameter, but I can’t find any guide how to set it up (what values to use etc…)
Best would be to map the active buzzer to the standard buzzer pin of this board, only by using the active buzzer save the necessary timer. Transistor to drive sufficient current should already be onboard, so using just this pin should be an advantage. How to find the right pin number if I’m not familiar with the source code?

There is a feature in 4.2 that allows you to do this with any PWM output. You just need to set the servo function on the output to alarm or alarm inverted

Thanks for the hint, but unfortunately I can’t do it - such function isn’t in the offer for any of outputs.


Here is an example for servo5 in my mission planner. U just updated to 4.2.0dev build from March 14th and checked mission planner for updates, but still not such choice available.
Additionally - where to find servo output assignment to physical pins for a specific board?
Thanks!

MP won’t have updated yet. Alarm is 138, inverted alarm is 139

Sorry, it doesn’t work anyway. I set servo6 to both functions 138 and 139, but neither seem to output any voltage to that pin. Mission planner updated today and is now showing options Alarm/Alarm inverted, but no output still. If I set some PWM to the servo6, it works.
Just for complete info: servo5 seem not working for anything, but as board reports in messages: “RCOut: DS600:1-4 PWM:6-8”, I guess that servo5 can’t be used for some conflict reasons.

You can’t use PWM5 as that shares a timer with PWM3 and PWM4. You can’t use PWM6 as that shares a timer with PWM1 and PWM2. I think you need to use PWM7 or PWM8.

If you are using bi-directional dshot PWM6 should work however.

Note that the feature only really works with 3-pin buzzers unless you provide some additional circuitry - the MCU can’t provide enough current on its own to drive a buzzer since this is a GPIO pin.

Thanks Andy, but I’m sorry it still doesn’t work. I plugged 3 pin buzzer to the pins PWM7 and PWM8 (should be on CH5 and CH6 pins if I understand correctly this hwdef.dat.) but buzzer is silent.
I’m and ciruit electronician, so I understand voltages, currents and necessary circuits and I’m sure my buzzer hardware works. (Understanding the code is worse for me :roll_eyes:) My buzzer is active HIGH level.
Any other ideas? Reaching further outputs after PWM5-8 is very hard on this board.

Seems like it should work. I have this board, if I get a chance I will try it. To be clear 3 pin buzzer you connect G, 5v and signal to the PWM out

In fact I made a transistor amplifier for the output current. NPN transistor with emiter on ground, collector over an active buzzer linked to +5V and base over 1k resistor to the PWM7 output. If output sends logical low, transistor is closed and buzzer is silent. If output DC voltage would get over +1V (logical HIGH is typically +3.3V, 1mA current is far enough), transistor would open and buzzer would beep.
I tested it by injecting voltage using an extra resistor and buzzer beeped. So it seems PWM7 doesn’t send any logical HIGH.

Andy, didn’t you have a minute to test “alarm” option for an PWM out, so I know whether it’s a bug in the software, or on my side?
Thanks! Roman

Works just fine for me - I connected a buzzer to PWM6 and set servo6 to alarm

Latest 4.2beta2

Thanks for testing: then I don’t understand it at all. I’ll load 4.2beta2 and try again - if that works for you, it must work for me as well!

Just an extra thought: do you have activated bdshot in your setup? Sorry for a stupid question, just I can’t understand why it works for you and not for me…

Yes bdshot was running. If you are running a Feb 22 build then that’s probably the issue - the support is quite recent.

To be sure, I bought real 3 wire active buzzer (this one) and tested it on PWM6, PWM7 and PWM8 with the firmware build Feb 22nd (the only working for me atm). All outputs the same way after FC boot go to logical 0 so buzzer starts continously beeping and don’t stop. Newer versions I may test later, when I solve problems with non working bdshot.

After loading daily build 2022-03-30-08:03 3 wire active buzzer at PWM6 started to work some way (setting “alarm inverted” on PWM6), but audio patterns doesn’t correspond with these described here.

Buzer signalizes boot up, arm, disarm, flightmode change etc, but when I simulated a crash, it was silent.
It generates just single tone beeps by the active buzzer, not modulated by ardupilot tones underneatch.

Can I activate lost model beacon? Is there a table for these sounds?

Sounds like its working. Single tone beeps sounds like the wrong kind of buzzer.

Sorry, my fault. I expected it will only on/off drive 3-wire active buzzer, but it’s normal output for (Ardupilot) standard melody buzzer (which works). When I connected 3-wire active buzzer, it “filtered” tones and beeped only in the same pattern. This caused my confusion.
Now I need only to discover how to activate “lost model beacon”.

Reading doc and discussion for already a half an hour, but I can’t find whether something like this feature - is already implemented or not?
Is there any “automatic” way to start audio becon to find lost model except the assigning to an AUX switch or (not much documented) stick gesture?
Thanks!
edit: I tested assigning an AUX channel to the option 30 and that works. Stick gesture pitch+roll down left doesn’t work for me. Should it work?