fastlink30 Posted November 16, 2015 Report Share Posted November 16, 2015 i'm trying to use audio with ugfx, to be more precise, i want use a piezo buzzer controlled with pwm, i looked example play-vs1053, but not understand how to selected the type of hardware to use (VS1053,pwm,adc), in this example is loaded the file audio, played etc, but how to set the port where to send 'audio'?there are other simple audio example with pwm? maybe i'm wrong but i not seethanks Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted November 16, 2015 Report Share Posted November 16, 2015 There is an existing PWM driver for the GAUDIO playback module. You can find the driver in /drivers/gaudio/pwm/.The entire hardware configuration (eg. what pins, which PWM peripheral etc.) happens through the board file - the same as all the pin configurations for the display happen through the GDISP board file.All you need to do is copying the board file template that you can find in the drivers directory to your project directory and implementing those four functions and you are ready to go. Note that the readme in the drivers directory contains some more information.Also note that when copying the template to your project directory you have to rename it so it doesn't say "_template" anymore. The file must be named gaudio_play_board.h.Let us know should you have any other questions.~ Tectu Link to comment Share on other sites More sharing options...
inmarket Posted November 16, 2015 Report Share Posted November 16, 2015 Have a look at the olimex SAM7EX256 board as an example. This is a supported board and it uses PWM audio.You should be using the play-wave demo. The vs1053 audio controller is a chip that is capable of decoding complex file formats like mp3. That is why it has its own demo - to demonstrate those extra capabilities. The pwm audio (and most other audio codecs) can only accept pcm data. Play-wave is the demo that converts a .wav file into pcm data and feeds it to the audio sub-system.If you want to decode more complex audio file formats than wave files you will need to either use a decoding library or upgrafe your hardware to use a specialist chip like the vs1053. Link to comment Share on other sites More sharing options...
fastlink30 Posted November 22, 2015 Author Report Share Posted November 22, 2015 ok, done, but i have problem to load the file from ROMgfxBufferAlloc is okwhen i try to open the file with gfileOpen, function fail (tryed with 'r' & 's')i have used the same file on the example dir of demos\modules\gaudio\play-vs1053\ronfs_files.h & romfs_allwrong.hthen included the file on the main.c with #include "romfs_files.h" (the bin file become more big, so datas are on the rom)#define GFILE_NEED_NATIVEFS FALSE #define GFILE_NEED_ROMFS TRUE#define GFX_USE_GAUDIO TRUE#define GFX_USE_GFILE TRUE#define GAUDIO_NEED_PLAY TRUE#define GAUDIO_NEED_RECORD FALSE#define GQUEUE_NEED_BUFFERS TRUE#define GQUEUE_NEED_GSYNC TRUE..... if (!gfxBufferAlloc(4, 512)) { errmsg = "Err: No Memory"; goto theend; }repeatplay: // Open the wave file if (!(f = gfileOpen(MY_PLAY_FILE, "r"))) { errmsg = "Err: Open WAV"; goto theend; } Link to comment Share on other sites More sharing options...
inmarket Posted November 22, 2015 Report Share Posted November 22, 2015 Is the definition of MY_PLAY_FILE correct?This should be a #define that matches the name of the file in romfs_allwrong.hAlso romfs_files.h should not be included in your main.cIt should be automatically included by ugfx because you have turned on the romfs system in your gfxconf.hThe easy way to tell is to add a #warning into romfs_files.hYou will then be able to see any time it is included Link to comment Share on other sites More sharing options...
fastlink30 Posted November 22, 2015 Author Report Share Posted November 22, 2015 #define MY_PLAY_FILE "allwrong.wav"removed the inclusion and add #warning to romfs_files.hno warning message showncan be my makefile? the path to romfs_files.h there are Link to comment Share on other sites More sharing options...
inmarket Posted November 23, 2015 Report Share Posted November 23, 2015 Best way from here is to debug into the gfileOpen in order to discover why it is not finding your file. Given that you get no warning displaying (you did do a make clean?) I suspect that the romfs code is not been included for some reason. Link to comment Share on other sites More sharing options...
fastlink30 Posted November 23, 2015 Author Report Share Posted November 23, 2015 the function ROMOpen not found the file in ROM, all the parameters seems good, so i think the files are not included on compilationthere are some particular things to do, to use GFILE functions? maybe i forgot some particular, i have enabled this 'flags'#define GFILE_NEED_NATIVEFS FALSE #define GFILE_NEED_ROMFS TRUE#define GFX_USE_GAUDIO TRUEon chibios (3.0.3) i do nothing, to compile i use makefile, maybe this do some difference? compilation not show errors, and firmware correctly work Link to comment Share on other sites More sharing options...
inmarket Posted November 23, 2015 Report Share Posted November 23, 2015 At this stage we will need a copy of your project to be able to help you more. Please cut out any code not relevant to this discussion and then zip the project and add it to a forum post.When we get a few minutes we will look at it. It may be a few days however as we are currently very busy. Link to comment Share on other sites More sharing options...
fastlink30 Posted November 23, 2015 Author Report Share Posted November 23, 2015 found the problem, is a path problem, i put an absolute path on include inside gfile\gfile_fs_rom.c (i know is really not good idea, but i want found the problem), and now the file is found, read, and i hope also playedon the makefile there are the path to the files romfs_files.h, so i not understand why is not included... must investigate more Link to comment Share on other sites More sharing options...
fastlink30 Posted November 24, 2015 Author Report Share Posted November 24, 2015 done, the first path in the makefile must be where is the romfs_files, otherwise search for the files fails.. Link to comment Share on other sites More sharing options...
inmarket Posted November 24, 2015 Report Share Posted November 24, 2015 Normally those files are found using the compiler include path. As the project directory should be on the include path that is where the files are normally put. Link to comment Share on other sites More sharing options...
fastlink30 Posted November 24, 2015 Author Report Share Posted November 24, 2015 and was like this, but i must put on first place the path to the files.. Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted November 24, 2015 Report Share Posted November 24, 2015 Glad to hear that you got it working!Keep up the good work ~ Tectu Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now