Playing a sound on MKRZERO

Hello everyone,

So I'm trying to play a .wav file on my Arduino MKRZERO (with the built in SD card reader). I have an 8-ohm speaker plugged into an LM386 low power amp, and the LM386 plugged into pin DAC0/A0 on the Arduino. I'm following this tutorial and have not changed the code other than the name of the wav file:

When I run the code, the SD card fails to initialize and I get this output:

Sketch uses 18972 bytes (7%) of program storage space. Maximum is 262144 bytes.
Global variables use 2784 bytes (8%) of dynamic memory, leaving 29984 bytes for local variables. Maximum is 32768 bytes.
Atmel SMART device 0x10010005 found
Device : ATSAMD21G18A
Chip ID : 10010005
Version : v2.0 [Arduino:XYZ] Dec 20 2016 15:36:46
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : none
Security : false
Boot Flash : true
BOD : false
BOR : false
Erase flash
done in 0.861 seconds

Write 18972 bytes to flash (297 pages)
[==============================] 100% (297/297 pages)
done in 0.172 seconds

Verify 18972 bytes of flash with checksum.
Verify successful
done in 0.020 seconds
CPU reset.

Not sure if the CPU reset is causing the SD card initialization to fail (or why its resetting in the first place), but the sound does not play. The SD card is formatted correctly and the wav file has the correct settings per the tutorial.

Any help would be greatly appreciated! This is my first post so I apologize if I forgot to include any key details!



This is just the normal console output from a successful upload to a MKR Zero. The CPU reset always happens at the end of the upload process. You'll see the same thing if you upload the standard Blink sketch to your MKR Zero. It has absolutely no relevance to your problem, so don't let it act as a "red herring" to distract you from your investigation of the true cause.

Hi Pert,

good to know, thanks! So I can focus on the SD card problems... Any idea why it won't initialize?

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.