Buzzer on GPIO Pins

I don't really understand what you are asking. Do you want to make a buzz come out of the speaker?

GPIO is generally the last resort for creating/simulating audio waveforms. Hopefully, the speaker itself is backended by a DAC (digital to analog converter) and isn't in any way connected to GPIOs.
 
Yes for multi-tone bootup sound experiment I have these.

Truthfully this probably belongs in U-Boot too for a Bios BEEP.
Set pinmux in U-Boot and maybe a u-boot script to toggle pin state for BEEP.

I was investigating that before I fell down the rockchip wormhole.

Just for context I drug this thread in too. I am rehashing an old subject.
I found no way to make gpio pins a device like /dev/speaker.
 
You typically use PWM to drive a buzzer. That said, there are also 'active' buzzers, they just need a voltage and they'll start buzzing on their own. No 'analog' signal required.
Driving a buzzer with PWM is wasteful because you don't need to vary the pulse width in a buzzer app. You just want enough average voltage within the window to trigger the relay or vibrate the coil. PWM is better suited to motor control apps, and then using dedicated PWM channels and not emulting thru GPIO (because dedicated PWM channels have their own timers and dont burden the CPU.
 
Back
Top