Probleme with moteino & RF69HW

Started by lcsbngg, June 05, 2015, 02:57:00 PM

lcsbngg

Hello everybody,

i need your help on a problem i can't solve :/

I have two things on SPI (the RFM69HW and my audio player : VS1053B)

here the main code i use :

void loop()
{



  if(digitalRead(tilt)==LOW)
  {

    val=random(1,5);
    sendData(val); 

    //    str=String(val);
    //Serial.println(val);
    //str.toCharArray(morceau,8);

    sprintf(morceau,"%d",val);

    if(val>99){
      morceau[3]='.';
      morceau[4]='m';
      morceau[5]='p';
      morceau[6]='3';
      morceau[7]='\0';
    }

    if(val>9 && val<100){
      morceau[2]='.';
      morceau[3]='m';
      morceau[4]='p';
      morceau[5]='3';
      morceau[6]='\0';
    }

    if(val<10){
      morceau[1]='.';
      morceau[2]='m';
      morceau[3]='p';
      morceau[4]='3';
      morceau[5]='\0';
    }

    Serial.println(morceau);

    // if(musicPlayer.stopped())
    // {
    Serial.println("debut local");
    musicPlayer.setVolume(volume,volume);
    musicPlayer.playFullFile(morceau); // ou startplayingfile a tester  
    Serial.println("fin local");
    // }

        temps = millis(); 
        while((millis() - temps) < tempsAction)
        {
          //Serial.println(millis());
          getAcc();
        }
  }

    else 
    {
  
      receiveData();
    }

}



I don't understand why when my program is running a music flle (musicPlayer.playFullFile(morceau), the program dont leave the fonction until the end of the file) and when the gateway send to it a data the music stopped and the moteino stop working

???

The usage i try is :

IF boutton HIGH
   Playfile number XX
   Send to gateway XX
   wait or do something during a specific time
ELSE
   listen if gateway send something



Hope you will have an idea because i try everything ....


thanks a lot for your help
(again sorry about my english ;)

Felix

WHat hardware do you use and how do you have the devices wired?

lcsbngg


Felix

Use another CS for your adafruit board. Used and available pins are shown here: https://lowpowerlab.com/moteino/#pinout
It looks like the music board requires 5V for power. Moteino is a 3.3V device so you must use buffering if the music board sends 5V signals to the Moteino.

lcsbngg

I already used an other pin because it was not working with the same pin.

I used 5V power and not 3.3V from moteino.


the problem come when my moteino is playingfullfile it receive a data from radio.

maybe the RF69HW stop the spi connection beetween the VS1053 and the moteino because it receive something...

Do you have a idea how to shut down the radio module or sleep or anything else and wake up after to be sur it's not that.... ???

Felix

You will need to check how the audio board library does the SPI communications. The RFM69 uses "SPI transactions". Perhaps there is a conflict on the SPI bus.

lcsbngg

Hello Felix,

thanks for taking time for me :)

I have search about "spi transactions" in my audio library and datasheet (https://www.sparkfun.com/datasheets/Components/SMD/vs1053.pdf) and i found nothing :/

I try a lot of other thing in my code like : sent a flag to my moteino gateway to avoid it send to a moteino which is playing but it's not working...

Is that possible to sleep the radio module or shutdown it .. ????? and wake up after ?

thanks again

Felix

Yeah: radio.sleep()
Wake it up by calling radio.receiveDone()

lcsbngg

Thanks :)


I think thats work ;) i have to test more because i have to leave soon today.

I will tell you ;) thanks again