How to Upload audio file in external flash memory using Arduino Zero and play it

I am trying to upload an audio file in 8 pin flash memory using arduino ZERO. But I dont know how to get started.
Also if you have any guideline on how to play audio file using arduino zero from external flash memory please let me know. Note that, the communication protocol should be SPI comm.

Has it ever occurred to you to search for this?

Try
https://www.arduino.cc/en/Reference/AudioZero

I am trying to upload an audio file in 8 pin flash memory

What is 8 pin memory?

I'm guessing 8-pin flash refers to an external flash chip, like those sold by adafruit. If so maybe the example code on their GitHub is relevant?

I'm guessing 8-pin flash refers to an external flash chip,

No no such thing.

You sure you don't mean 8 bit flash?
In the adafruit link "8 pin" is a description of the number of pins the package has, in no way is this relevant to what is inside the chip.

You can't upload anything into that unless it is connected to an Arduino. Then you would have to write some code that takes data from the serial port and stores it somewhere in that chip. And then you have to write code on a laptop to read a .wav file and send the bytes from it one at a time to the Arduino, you can use the Processing language to do that.

I think you may be way out of your depth with trying to do this.

If so maybe the example code on their GitHub is relevant?

Not relevant at all.

Stick to an SD card that you can store files from your laptop into and transfer the card to your Arduino SD card reader. Like in the link I sent you.

Thanks Grumpy_Mike.
But I need to know how to load an audio file in an external flash memory. Can you suggest me anything on that?

I want to load an audio file in an external flash memory (example: AT25DF081A-Adesto). Read the file through SPI communication protocol using Arduino ZERO

Grumpy_Mike:
No no such thing.

You sure you don't mean 8 bit flash?
In the adafruit link "8 pin" is a description of the number of pins the package has, in no way is this relevant to what is inside the chip.

You can't upload anything into that unless it is connected to an Arduino. Then you would have to write some code that takes data from the serial port and stores it somewhere in that chip. And then you have to write code on a laptop to read a .wav file and send the bytes from it one at a time to the Arduino, you can use the Processing language to do that.

I think you may be way out of your depth with trying to do this.
Not relevant at all.

Stick to an SD card that you can store files from your laptop into and transfer the card to your Arduino SD card reader. Like in the link I sent you.

nafis12:
But I need to know how to load an audio file in an external flash memory. Can you suggest me anything on that?

That is what I just suggested.

You can't upload anything into that unless it is connected to an Arduino.

What sort of answer were you expecting?

Grumpy_Mike:
That is what I just suggested.
What sort of answer were you expecting?

I need help in SPI communication in arduino ZERO to load audio file in an external flash memory. To be honest I need help with code.

nafis12:
To be honest I need help with code.

Do you need help with using SPI on a ZERO or using SPI for reading/writing to the AT25DF081A? These are two separate issues.
I think Mike is suggesting that you just use an SD card. Is there a reason that this is not possible? Why do you need to use the AT25DF081A?

I need help in SPI communication in arduino ZERO to load audio file in an external flash memory.

You can only load the flash memory from an Arduino. Arduinos do NOT have access to a file system. So it becomes a matter of where that audio file will come from. Unless you know that, and can communicate it to us, then there is not much else we can do.

I have given you help on one way to do this.

You may be mixing up "help with code" and "writing the code for you". Here, we do the former but not the latter.

We don't write code for you, we tell you what to do, like I have, and we help you iron out the bugs in the code you have written.

If you want the latter then click on the "report to moderator" link under the first post, and ask to have this thread moved to the gigs and calibration section. People here will write code for you, for money, so say how much you want to spend on this.

Hello Grumpy_Mike. I will send data bit by bit (from audio file) to an EEPROM. But somehow the following part of the code is showing error when I run in on Arduino Zero (in slave mood). In case of Uno, it works fine. But I want to do my project on Zero.
ISR (SPI_STC_vect)
I have attached the full code below:
#include<SPI.h>
volatile boolean received;
volatile byte Slavereceived,Slavesend;
int buttonvalue;
int x;
void setup()
{
Serial.begin(115200);
pinMode(MISO,OUTPUT); //Sets MISO as OUTPUT (Have to Send data to Master IN
SPCR |= _BV(SPE); //Turn on SPI in Slave Mode
received = false;
SPI.attachInterrupt(); //Interuupt ON is set for SPI commnucation

}
ISR (SPI_STC_vect) //Inerrrput routine function
{
Slavereceived = SPDR; // Value received from master if store in variable slavereceived
received = true; //Sets received as True
}
void loop()
{ if(received)
{
Slavesend=1;
SPDR = Slavesend; //Sends the x value to master via SPDR that will turn ON LED if x=1
delay(1000);
}
}

Grumpy_Mike:
You can only load the flash memory from an Arduino. Arduinos do NOT have access to a file system. So it becomes a matter of where that audio file will come from. Unless you know that, and can communicate it to us, then there is not much else we can do.

I have given you help on one way to do this.

You may be mixing up “help with code” and “writing the code for you”. Here, we do the former but not the latter.

We don’t write code for you, we tell you what to do, like I have, and we help you iron out the bugs in the code you have written.

If you want the latter then click on the “report to moderator” link under the first post, and ask to have this thread moved to the gigs and calibration section. People here will write code for you, for money, so say how much you want to spend on this.

I have attached the full code below:

But not posted it correctly according to the forum rules :- How to get the best out of this forum

But somehow the following part of the code is showing error when I run in on Arduino Zero (in slave mood). In case of Uno, it works fine. But I want to do my project on Zero.
ISR (SPI_STC_vect)

Are you just looking at random code and hoping to find one that works?

First of all the processor used in the Uno has an interrupt vector called SPI_STC_vect. The one in the Arduino doesn't have this vector, which is why you get this error. It does have one that does a similar thing but using a different name.

But most importantly why do you think this code has anything to do with what you want to do?

This code sets the SPI interface into a slave mode so that if an SPI device were to send you a byte, the code would stop what it is doing, get the byte and do something with it and then continue from where it was interrupted.

Your flash memory is also a slave device, which means it can never spontaneously send you a byte and why should it? You are trying to write a byte to the flash memory and later you will need to read from it too. The Arduino needs to be the master device, so it is in charge of what is being written or read from your flash memory.

As I keep pointing out that byte has to come from an audio file so you need to get it from a place that has it. You still have not embraced that concept.

I think conceptually you are way way out of your depth here, let alone knowing how to implement these concepts. What have you got against SD cards or is this a class assignment and the instructions said don't use SD cards?

I have no experience with this particular library, but Adafruit has an SPIFlash library which would presumably provide a higher level API (FAT filesystem) to the device and which includes example code: GitHub - adafruit/Adafruit_SPIFlash

Grumpy_Mike:
But not posted it correctly according to the forum rules :- How to get the best out of this forum

Are you just looking at random code and hoping to find one that works?

First of all the processor used in the Uno has an interrupt vector called SPI_STC_vect. The one in the Arduino doesn’t have this vector, which is why you get this error. It does have one that does a similar thing but using a different name.

But most importantly why do you think this code has anything to do with what you want to do?

This code sets the SPI interface into a slave mode so that if an SPI device were to send you a byte, the code would stop what it is doing, get the byte and do something with it and then continue from where it was interrupted.

Your flash memory is also a slave device, which means it can never spontaneously send you a byte and why should it? You are trying to write a byte to the flash memory and later you will need to read from it too. The Arduino needs to be the master device, so it is in charge of what is being written or read from your flash memory.

As I keep pointing out that byte has to come from an audio file so you need to get it from a place that has it. You still have not embraced that concept.

I think conceptually you are way way out of your depth here, let alone knowing how to implement these concepts. What have you got against SD cards or is this a class assignment and the instructions said don’t use SD cards?

yes I are probably right I am very new with arduino and have never worked with flash memory neither have a good understanding on it. I just got interested in this and trying to do this. Not a class assignment or anything like that. Just trying to build a compact system with SAMD21 and flash memory to play an audio file using SPI communication.