Producing a square wave on a gumstix GPIO

View: New views
3 Messages — Rating Filter:   Alert me  

Producing a square wave on a gumstix GPIO

by Scott Harris :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to generate a square wave on a gumstix GPIO pin in order tor drive a piezo buzzer for user feedback.  I'd like to achieve this in python if possible, but I'm not averse to writing some C code to do fiddle with pxaregs. I also need the beeper code not to block my main python loop, since that code is pretty busy.


Does anyone have some suggestions on a minimum hassle path to achieve this?

Thanks,
-Scott

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gumstix-users mailing list
gumstix-users@...
https://lists.sourceforge.net/lists/listinfo/gumstix-users

Re: Producing a square wave on a gumstix GPIO

by Ryan Rapetti :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe a second thread to do the beeping? Then the main thread just signals. I'd still worry about the buzzer thread getting preempted though. Now that I think about it, the serial port produces a nice clean square wave. By playing with the data and the baud rate you could probably make it work ok. Then all you need to do is write the proper data to the buffer and be on your way. You'd need an amplifier circuit to isolate the UART from the buzzer, but an op-amp or a properly wired transistor should work nicely for that.

Ryan

Scott Harris wrote:
I need to generate a square wave on a gumstix GPIO pin in order tor drive a piezo buzzer for user feedback.  I'd like to achieve this in python if possible, but I'm not averse to writing some C code to do fiddle with pxaregs. I also need the beeper code not to block my main python loop, since that code is pretty busy.


Does anyone have some suggestions on a minimum hassle path to achieve this?

Thanks,
-Scott

------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

_______________________________________________ gumstix-users mailing list gumstix-users@... https://lists.sourceforge.net/lists/listinfo/gumstix-users


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gumstix-users mailing list
gumstix-users@...
https://lists.sourceforge.net/lists/listinfo/gumstix-users

Re: Producing a square wave on a gumstix GPIO

by gumstix_user :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you are doing low frequency stuff you can treat the GPIO lines as files. They are located in /proc/gpio

just open the I/o line you want such as "/proc/gpio/GPIO66" etc and then fprint or fwrite "GPIO out set" or "GPIO out clear" to set the logic level for that bit.

Sometimes you may need to change the tristate state of the line before you use it. This can easily be done with a script.



Scott Harris wrote:
I need to generate a square wave on a gumstix GPIO pin in order tor drive a
piezo buzzer for user feedback.  I'd like to achieve this in python if
possible, but I'm not averse to writing some C code to do fiddle with
pxaregs. I also need the beeper code not to block my main python loop, since
that code is pretty busy.


Does anyone have some suggestions on a minimum hassle path to achieve this?

Thanks,
-Scott

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
gumstix-users mailing list
gumstix-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gumstix-users