Play RAW from Serial Flash

Status
Not open for further replies.
Yes there is. Add the code below to whatever sketch youre using to trigger the flash samples.

Be sure there are no delay() used or it will mess things up. The elapsedmillis goes right ahead of the loop.


Code:
elapsedMillis fps;

void loop() {


      Serial.print(" FPS: ");
      Serial.print(fps);
      Serial.print(" PLY: ");
      Serial.print(sound1.isPlaying());
      Serial.println(" PLAYING");


}
 
Thanks Frank!


Not sure if its in your audio conversion tool (wav2raw) or in the isplaying function. But something is off by 50% it appears.
 
You're right:

a temporary fix:
edit play_serialflash.cpp, in function void AudioPlaySerialFlash:: play(const unsigned int data) :

Code:
	length |= (temp & 0xff00) << 8;
	playing = temp & 0xff;
[B]	if (playing > 0x80) length*=2;[/B] //<-- add this line
	__enable_irq();
(but then, lengthMillis() will be wrong)

...or wait till tomorrow for a better fix :)
 
I had come across the same problem some time back but assumed I'd done something stupid :)

Going to follow your initiative, and rename all my files to TRW extension, and eliminate further confusion.
 
so it's SPIFIFO only now?

mmh, so is there a quick way to make spi_flash work alongside SPIFIFO? i guess not ...
 
@mxxx,

whats the problem with spi_flash ?

it's not really a problem, but when using flash_spi.h/cpp in the same sketch it conflicts with SPIFIFO. i meant to look into re-writing flash_read_pages() etc as SPIFIFO but a quick hack* is to just call SPIFIFO.begin() again in setup, ie after having read out what's on the flash.

* edit. well, almost. that work-around doesn't work, for some reason, when CS is a non-native chip select. guess i have to look into flash_spi / SPIFIFO after all.
 
Last edited:
can someone (or Frank) enlighten me, please.... why is it that SPIFIFO and play_sd_wav seem to play nicely together, but use of the regular SPI stuff is uncooperative when combined with play_serialflash.cpp ?


specifically, i've rewritten the few things i need from the flash_spi library using SPIFIFO but i'm stuck with actually making use of spififo_flash_page_program (= flash_page_program) because this needs to simultaneously read from SD card, too (ie flashing the data, verifying it). as soon as i've initialised the flash, SD.open(DIRECTORY); etc no longer work. i can see there's a line called SPISettings spisettings; in play_serialflash.h, but it's not actually used anywhere?
 
maybe i have to implement the spi-transaction stuff.. ?
this is missing. i had it in the fifo-less version, but it's still not in the "fifo" version.

Maybe you want to provide a patch ?
 
Last edited:
maybe i have to implement the spi-transaction stuff.. ?
this is missing. i had it in the fifo-less version, but it's still not in the "fifo" version.

Maybe you want to provide a patch ?

mmh, i can give it a try but before i can think about patches i really have to figure out what's going on. the fifo version is probably fine as is, i have no issues using it in parallel with play_sd_wav. what doesn't work is either of the following:

a) play_serialflash (using spififo) + play_sd_wav + flash_spi (regular version): spififo freezing up

or

b) play_serialflash (using spififo) + play_sd_wav + flash_spi (using spififo): SD freezing up

that will only bother people who don't want to hardcode/manually put in the file addresses returned by the flash-tool. i can't seem to figure out what play_serialflash is doing to prevent the conflict. as noted above, there's an easy hack for a) but that doesn't seem to work as a general solution and i'd rather go with b) anyways.
 
no rush. i think it was more of a conceptual question anyways; but it doesn't seem like you specifically prevented something from happening then.


edit: nevermind, i've identified the problem and opened another thread as it's some tangential to this one ...
 
Last edited:
no rush. i think it was more of a conceptual question anyways; but it doesn't seem like you specifically prevented something from happening then.


edit: nevermind, i've identified the problem and opened another thread as it's some tangential to this one ...

though SPIFIFO might not work for me, then -- i guess it might be related to this question.
if i have to move back to using regular SPI: what caused the bug in #159, Frank? (i think the fix was/is part of the SPIFIFO-only version)

ups. sorry, meant to edit the post ...
 
Last edited:
Hi there!

Good news for the people who don't consider them soldering-iron heroes:
last tuesday I got in the smaller winbond 25Q64B chip in dip8 package.

I can confirm it almost works:
The samples get verified succesfully.
I can't play samples yet (last time I checked it played a noise hit).
Is this because I run teensyduino 1.20?

For flashing this chip, change the define FLASHSIZE to 0x800000

and comment this line:
if (id_tab[0]!=0xef || id_tab[1]!=0x40 || id_tab[2]!=0x18 || id_tab[3]!=0x00) {Serial.println(" is not ok."); goto end;}
id_tab[2] checks the size of the chip (mine says 0x17).

Perhaps FLASHSIZE can be adjusted based on this information on the fly?
 
Last edited:
Has anyone already succeeded using the new Serialflash library and play_Serialflash together?
Tonight I tried, but as soon as I call Serialflash.begin, FrankB's library stops.

or is there an easier way to work around this?
 
i've been busy for 2/3 months - is there a new version of flash_spi?

if not - yes, i have got it working no problem.

if there is a new version since 3 months ago, then ignore me.
 
I haven't seen a new version of flash_spi, the last few months.
If you have some hints/code to make these two libraries play together,
would you please share them?
 
Sorry, I've done some research - you are referring to a significant amount of work Paul has been doing fairly recently. I have flash_spi and playserialfash working fine but "SerialFlash" appears to be the "new and improved" version of all that.

So no, I havent touched it. I have a working solution based on Frank Boesing's codebase and flash_Spi. SerialFlash is something I have not looked at yet.
 
Yes, I want to update this..
I can't promise anything - unfortunately i have not much time at the moment, and I'm playing with a Teensy-SPDIF-output (which looks really good, I think I have a first working "alpha" soon!)

As soon as the alpha-SPDIF is working, I'll update the "Play RAW"
 
Last edited:
Status
Not open for further replies.
Back
Top