Une exception de première chance de type ‘System.IO.IOException’ s’est produite dans Microsoft.SPOT.IO.dll
Error invoking method “Gadgeteer.Modules.GHIElectronics.SDCard” (check arguments to Program.BeginInvoke are correct)
J’ai changer le formatage de la carte SD Fat32, avec essai de plusieurs taille de Cluster :
La lecture du fichier sarrête a la taille du Cluster,
Cluster de 4 Ko => Lecture 4 Ko puis erreur…
Cluster de 8 ko => Lecture 8 Ko, puis erreur de lecture…
Voici une portion de code
Lecture de fichiers MP3 sur Module SD Card vers Module Music GHI Electronics
/// A Music module for Microsoft .NET Gadgeteer
///
/// Original source from:
/// http://gadgeteer.codeplex.com/SourceControl/changeset/view/14634
/// <summary>
/// Playback stream thread function
/// </summary>
private void PlayBackStreamThreadFunction(Stream file )
{
byte[] block = new byte[1024];
m_SPI.Config = m_dataConfig;
int Nboctet = 0;
int total = 0;
while ( (Nboctet = file.Read(block, 0, block.Length)) > 0)
{
total += Nboctet;
Debug.Print("Lecture de : " + total.ToString() + " Octets ");
if (_stopPlayingRequested) break;
while (m_dreq.Read() == false)
Thread.Sleep(1); // wait till done
// fake spinlock is fake
while (true)
{
if (!m_bPlayLocked)
{
//someone still has the spi
Thread.Sleep(1);
}
else
{
// we can have the spi back
m_SPI.Config = m_dataConfig;
break;
}
}
m_SPI.Write(block);
}
if (file != null)
{
file.Close();
file = null;
}
Reset();
_isPlaying = false;
this.OnMusicFinished(this);
}
Il faut essayer de faire un effort de traduction et de clarification du probleme. Nous continuons donc en anglais pour que la majorité de la communauté puisse un jour réutiliser ce thread.
If I were you I would try with an other SD card. Be sure also of your power supply most troubles with sd card comes from bad compatibility of the SDCARD with GHI modules or Bad power sources.
Have you written this code or is it a code that you found somewhere else?
Google translation
I will try with an additional power, then with another SD card
My problem, I format my sd card with 1 KB cluster, an exception is thrown after reading a KB, I formatted with cluster of 8 KB, the exception is raised after the reading of 8 KB
I can not read files greater than the size of the cluster.
I can enchainer reading several files, if they are less than a maximun size of clusters.
Formatting for SEVEN, Fat32 …
My code comes from:
As I do not have gadgeeter, I can’t try the code you find on codeplex. On all the FEZ target that I have I don’t take care about clustering. I buy an µSD CARD, I plug it in the slot, and that’s it. I can not say that I have no problem with SD (sometimes an SD card that is compatible with a given board will not work on a sisterchip FEZ based board)…
The first thinig try is to change SD card to see if SD is OK or not (some of them are created noise on power source…) then if changing SD does not solve the issue, changing the power module with a better one (if possible). In parralel the FEZ community that have time and the same target should try your code to see if the same problem occurs.