No announcement yet.

Please help, unknown problem!

  • Filter
  • Time
  • Show
Clear All
new posts

  • Please help, unknown problem!

    I'm having problems playing any sound files from the module...for some reason, the speaker only emits a low buzzing noise, though the busy light remains on. Have wired up the module as per the data sheet for serial mode, and, with a PIC18F4520, have just modified Microchip's example I2C Master code for the program, but, thus far, no luck. I'm not sure if the problem is the baud clock operating rate (400 kHz), the .ad4 conversion rate (32 kHz), the fact that I'm using I2C instead of SPI, or something else. Thanks in advance, I'm new to this!

  • #2

    Not really sure where you got the idea you could communicate with this devices using I2C. The communications protocol looks a bit like I2C, but it isn't. Also the maximum speed is quite a bit less than the minimum I2C speed.

    It doesn't do SPI either.

    To get started just get it working in Key mode first.

    Then try bit banging the commands frm your PIC18F4520


    • #3

      Thanks for the reply!

      How should I go about bit banging commands? Could I use something like EUSART? I've been looking at the codes people have posted on this site, but can't figure out exactly what I need to do.


      • #4

        Just configure the pins on your PIC as digital I/O.

        The use one of the PICAXE examples and change it as necessary


        • #5

          Thank you!

          I just have one more problem: my speaker is just outputting clicks (like a metronome), and no song. Seeing that someone else had the same problem, I upped the capacitor value on Vdd to 325uF, and decoded the .ad4 file I had, but the file played correctly on the computer, and the clicks continued. My timing is a bit off on the 2ms (it's about 5 ms, due to a max Fosc of 8Mhz) start bit, would that be what's wrong?

          If this is just a timing issue, I can implement a timer; just want to be sure before I change a bunch of things on the circuit.


          • #6

            It sounds like the .ad4 files are not quite the correct format. What happens when you use one of the sample .AD4 files?


            • #7

              I re-formatted the card, then put the sample files on, but it's about the same. I am hearing some static, though, between clicks (~ every 1 to 2 seconds).


              • #8

                Hmm, I seem to recall something like that if you send to much data to it, does it work it 'key' mode?


                • #9

                  It works perfectly in key mode. I've been just modifying the SOMODuino code someone posted, I'll put down what I have:

                  // Header Files
                  // Configuration Bits
                  #pragma config OSC = INTIO67 // Internal osc
                  // #pragma config OSC = EC // EC = External 4MHz for demo board only
                  #pragma config WDT = OFF
                  #pragma config LVP = OFF
                  #pragma config BOREN = OFF
                  // I/O Declarations
                  #define PushButton PORTAbits.RA0
                  // Define Constants
                  #define DELAY_TIME 10
                  // Local Function Prototypes
                  void sampleFunction(void);
                  void SendData(int ThisSong);
                  void PlaySong(void);
                  // Global Variables
                  int sampleVariable = 0;
                  const unsigned int minVolume=0xFFF0;
                  const unsigned int maxVolume=0xFFF7;
                  const unsigned int playPause=0xFFFE;
                  const unsigned int sTop=0xFFFF;
                  int clockCounter = 0;
                  int clockCycle=15;
                  int ThisSong;

                  #pragma code
                  void main(void)
                  TRISDbits.TRISD0=0; //Sets RD0 as an output pin
                  TRISDbits.TRISD1=0; //Sets RD1 as an output pin
                  TRISDbits.TRISD2=0; //Sets RD2 as an output pin
                  TRISDbits.TRISD3=1; //Sets RD3 as an input pin
                  while (1)

                  * Function: void SendData(void)
                  void SendData(int ThisSong)
                  PORTDbits.RD0=1; //Sets RD0 high (in this case, RD0 is clock pin)
                  Delay10KTCYx(60); //Delays for 300 ms at 8MHz
                  PORTDbits.RD0=0; //Sets RD0 low
                  Delay10KTCYx(1); //Delays for ~5 ms at 8MHz

                  while (clockCounter


                  • #10

                    Looks like you are telling it to play this song again and again repeatedly, so it never really gets a chance to actually start playing it.

                    Put a large delay between each request or move the loop elsewhere


                    • #11

                      You also might want to consider polling the 'busy' pin rather than using finite delays.

                      Buddy - GorillaBuilderz


                      • #12

                        Thanks very much all! It's working now. :-)