I am using a Teensy 4.0 with a Rev D audio shield. This is a museum exhibit that continuously plays one of 19 tracks (.wav files) stored on a 32GB micro SD card plugged into the audio shield, the track is selected by a visitor. There is a small TFT LCD on the other SPI bus and a timer / counter running on interrupts.
The unit is turned on every morning and off at night. I have found that the CPU is crashing after a few days and damaging the track that was being played so that, once damaged, it crashes every time it reaches this point. The first card this happened to was totally wrecked and could not be read on my PC. The second card has survived many crashes without such damage and when playing the track on the PC, it just stops at the damage point. I reformatted this card and reloaded the files and it worked again - for a while.
Any help gratefully received as I am stumped!
I managed to print the crash report which shows it is running the sound driver which starts with this header:
/* Audio Library for Teensy 3.X * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
This is the crash report:
Code was executing from address 0x36B0
16:39:50.088 -> CFSR: 82
16:39:50.088 -> (DACCVIOL) Data Access Violation
16:39:50.088 -> (MMARVALID) Accessed Address: 0x20004E40 (Stack problem)
16:39:50.088 -> Check for stack overflows, array bounds, etc.
16:39:50.088 -> Temperature inside the chip was 40.25 °C
and the address 0x36B0 is in this the middle of this section, I've attached the whole .lst file (zipped):
36a0: 2000 movs r0, #0
36a2: f884 0271 strb.w r0, [r4, #625] ; 0x271
block_right->data[block_offset++] = (msb << 8) | lsb;
36a6: f8b4 0068 ldrh.w r0, [r4, #104] ; 0x68
msb = *p++;
36aa: 46d8 mov r8, fp
block_right->data[block_offset++] = (msb << 8) | lsb;
36ac: 6e67 ldr r7, [r4, #100] ; 0x64
size -= 2;
36ae: 3d02 subs r5, #2
block_right->data[block_offset++] = (msb << 8) | lsb;
36b0: f938 3b02 ldrsh.w r3, [r8], #2
36b4: eb07 0740 add.w r7, r7, r0, lsl #1
36b8: 3001 adds r0, #1
36ba: f8a4 0068 strh.w r0, [r4, #104] ; 0x68
36be: 80bb strh r3, [r7, #4]
if (block_offset >= AUDIO_BLOCK_SAMPLES) {
36c0: f8b4 3068 ldrh.w r3, [r4, #104] ; 0x68
36c4: 2b7f cmp r3, #127 ; 0x7f
36c6: d80f bhi.n 36e8 <AudioPlaySdWav::consume(unsigned long)+0x318>
The unit is turned on every morning and off at night. I have found that the CPU is crashing after a few days and damaging the track that was being played so that, once damaged, it crashes every time it reaches this point. The first card this happened to was totally wrecked and could not be read on my PC. The second card has survived many crashes without such damage and when playing the track on the PC, it just stops at the damage point. I reformatted this card and reloaded the files and it worked again - for a while.
Any help gratefully received as I am stumped!
I managed to print the crash report which shows it is running the sound driver which starts with this header:
/* Audio Library for Teensy 3.X * Copyright (c) 2014, Paul Stoffregen, paul@pjrc.com
This is the crash report:
Code was executing from address 0x36B0
16:39:50.088 -> CFSR: 82
16:39:50.088 -> (DACCVIOL) Data Access Violation
16:39:50.088 -> (MMARVALID) Accessed Address: 0x20004E40 (Stack problem)
16:39:50.088 -> Check for stack overflows, array bounds, etc.
16:39:50.088 -> Temperature inside the chip was 40.25 °C
and the address 0x36B0 is in this the middle of this section, I've attached the whole .lst file (zipped):
36a0: 2000 movs r0, #0
36a2: f884 0271 strb.w r0, [r4, #625] ; 0x271
block_right->data[block_offset++] = (msb << 8) | lsb;
36a6: f8b4 0068 ldrh.w r0, [r4, #104] ; 0x68
msb = *p++;
36aa: 46d8 mov r8, fp
block_right->data[block_offset++] = (msb << 8) | lsb;
36ac: 6e67 ldr r7, [r4, #100] ; 0x64
size -= 2;
36ae: 3d02 subs r5, #2
block_right->data[block_offset++] = (msb << 8) | lsb;
36b0: f938 3b02 ldrsh.w r3, [r8], #2
36b4: eb07 0740 add.w r7, r7, r0, lsl #1
36b8: 3001 adds r0, #1
36ba: f8a4 0068 strh.w r0, [r4, #104] ; 0x68
36be: 80bb strh r3, [r7, #4]
if (block_offset >= AUDIO_BLOCK_SAMPLES) {
36c0: f8b4 3068 ldrh.w r3, [r4, #104] ; 0x68
36c4: 2b7f cmp r3, #127 ; 0x7f
36c6: d80f bhi.n 36e8 <AudioPlaySdWav::consume(unsigned long)+0x318>