Sei sulla pagina 1di 7

SFEMP3

So when the SS or pin 10 is configured as an input the ATmega328s SPI is a slave, which is NOT supported by
Arduinos libraries. Basically the SPI does not work. Since the ATmega328 SCK pin is now an input expecting clock,
rather than generating clock towards slave, as when a Master. Hence SS or pin10 must be configured as an Output,
if one desires the SPI to work (i.e. as a Master). In which that output can by used for any purpose. By convenience it
is often used to drive the enable of the attached slave SPI devices. But it could be any digital output that drives
external slaves enables, it does not have to be SS (as it means nothing in master mode)
to move the SD Cards chip select change SFEMP3ShieldConfig.h line 168 to the pin of your choice. Or create a
#ifdef to match your circuit.
Whereas, to use other timers does not necessarily prohibit the use of their associated pins for GPIO. The pins are
free for other use, unless the timer is configured to be used as its timer function e.g. Generate either a Output
Compare or PWM or Input Capture.
Note that the example libraries behavior can be configured to use Timer1 library, in place of Interrupts, without
changing the pins. by changing SFEMP3ShieldConfig.h line 195

The SFEMP3Shield Library defines all of its hard resources and configurable options in the SFEMP3Shield.h file. The
SdCards chipselect is defined with SD_SEL . Notice its how it sets up the sd.begin(SD_SEL, SPI_HALF_SPEED in
the example. You can substitute any value you like into or in place of the SD_SEL. Assuming it is actually connected
to the SdCards Chip Select.
Member
Awesome, I found the define SD_SEL pin assignment in SFEMP3Shieldconfig.h. Changed it to pin 10, soldered in a
new wire from D10 to pin 5 of the 74HC4050 converter, and it works perfectly. Now I can use pins 9 and 10 for
Timer1.
Error Code 4 indicates that the library did not get back the expected value back from the VS1053 chip, while trying to
initialize it just after reset or boot. Where you are able to read the SdCard.

After commenting out the above mentioned line; Did it play successfully?

Note: SM_LINE1 & SM_SDINEW are DEFINEs of bit masks of the SM_MODE register. On these bit positions on the
VS1053 should be the only values set true in the SM_MODE register after reset. Your prints showing 00 is indicating
you are likely not talking to the Chip.

I am not familiar with the Seeeduino (Duemilanove clone). I would expect it to be equal to the Duemilanove not
requiring anything special. Check you solder connections of the headers and perhaps ohm out the connections from
chip to chip. And check that the pins are working as expected all they from the Duemilanove to the VS1053.

I also see the Seeeduino (Duemilanove clone) has a 3V vs 5V switch. Ensure it is 5V, if you have not modified the
SFEMP3Shield for 3V operations, as noted in the GitHub Page. If this is the problem, let me know I will update the
Troubleshooting Guide to additionally include this about the Seeeduino (Duemilanove clone). Although I doubt this
the problem.
Good morning everyone.
Im Italian so sorry for my English!
I connected Arduino Mega with SparkFun shield mp3 + sd and everything works perfectly with the keyboard and
serial.
I then inserted library <IRremote.h> to change songs by remote control and works, but if I get the songs end up going
the wrong numbers on the remote control and the program does not work anymore. Someone can help me?

January 2, 2013 at 9:26 am #1769

Michael P. Flaga

Member
I have been thinking about attempting just such. Noting that IRremote and SFEMP3Shield both use interrupts. Hence,
I expected a conflict between them, resulting in corrupted received IR values, but not necessarily a lock up. The
SFEMP3Shields default setup of using INT0 is not very real time efficient as it reads the SdCard while in the service
of INT0. During which the IRremotes Timer1 interrupt is blocked.

As a possible work a round by changing the SFEMP3ShieldConfig.h of

#define USE_MP3_REFILL_MEANS USE_MP3_INTx

to

#define USE_MP3_REFILL_MEANS USE_MP3_Polled

along with placing

MP3player.available();

in the main loop. This would preclude the interrupt conflict and believe it should work. Where it may have the draw
back of having short pauses of the playing audio, when receiving a IR command. If this happens leave off the
IRremote DEBUG, to help and limit any blocking activities in the loop(). Serial Prints may also delay.

Let us know how it works or has problems.

January 3, 2013 at 5:23 am #1789

gianlu23

Member
Perfect work!
Youre number one!
thank you very much
Gianluca

January 3, 2013 at 10:33 am #1790

Michael P. Flaga

Member
I believe that means it works perfectly.

I am glad it does.

Is there any observations. Or problems, such as skipping sound when IR data is being decoded?

January 3, 2013 at 4:38 pm #1792

gianlu23

Member
everything works and does not crash!

there just a small detail that affects the function playTrack ();

cause if I want to change the first song I Do:

MP3player.stopTrack ();

MP3player.playTrack (1);

otherwise does not change the song. Pause and resume functions I still can not make it go.

January 4, 2013 at 10:00 am #1793

Michael P. Flaga

Member
Stopping before playing next track is normal.

I can understand that the Pause and Resume can be tricky as my example is stateless, hence the two separate
commands. Need to tie a state machine (aka Boolean flag) around them if you want the same IR key to toggle pause.

January 5, 2013 at 6:25 am #1797

gianlu23

Member
I acquire the value from the remote control and I see that correct.

then run

else if(results.value==play_pause){
if(MP3player.isPlaying()){
MP3player.pauseDataStream();
}
else{
MP3player.resumeDataStream();
}

all other commands are correct.


I do not think its normal stop the song rather then change it cause if I send the serial command to change song I just
need
MP3player.playTrack (1);
without first stopping the song.

January 5, 2013 at 3:41 pm #1798

Michael P. Flaga

Member
Please note the isPlay() does not reflect the complete status. It only indicates if a file is supposed to be playing at the
moment. It does not reflect if it is paused. Playing another file while paused, still indicates a positive for isPlaying().
Hence this can not be used for un-pausing, the way you want.

I have added new function getState(), see the example p command at My current GitHub Fork/Branch . I have
changed the p command to now toggle pause on and off. It shows how to use the getState() command. This should
be representative of what your are attempting.

Your observation that playTrack (1); called after pauseDataStream(), actually un-paused the play, was not the
desired effect. This is corrected. It will now require a stop.

Also please note that this version requires the Sd.Begin in the main INO and there are some typo corrections of Get
vs get / Set vs set of some function names. All are shown in the example.

Have fun.

Potrebbero piacerti anche