Is it needed to flush it? If it gets overwritten anyway (by the read), an arm_dcache_delete() would be faster.
KurtE said:Try syncing up to my USBHost_t36 FS_Integration_MSC branch... I believe the AAC and MP3s are now working without changes to core.
I've fixed FLAC (Tested with 3.6 only - T4 seems to be not reliable at the moment?)
https://github.com/FrankBoesing/Ard...mmit/576d62c4f15da3f80fc5b9ee14332bfae175ccf8
Is it needed to flush it? If it gets overwritten anyway (by the read), an arm_dcache_delete() would be faster.
size_t CodecFile::fillReadBuffer(File file, uint8_t *sd_buf, uint8_t *data, size_t dataLeft, size_t sd_bufsize)
{//TODO: Sync to 512-Byte blocks, if possible
memmove(sd_buf, data, dataLeft);
size_t spaceLeft = sd_bufsize - dataLeft;
size_t read = dataLeft;
size_t n;
if (spaceLeft>0)
{
n = fread(sd_buf + dataLeft, spaceLeft);
dataLeft += n;
...
Please do not submit pull requests with GPLv3 code.
I want to be absolutely clear - this code will never be merged into the Teensy audio library because of Frank's choice to apply GPLv3.
2. Request to @wwatson to update his fork of Franks lib with all the changes for FS: https://github.com/wwatson4506/Arduino-Teensy-Codec-lib/pull/1
Space Used = 68780032
Filesystem Size = 32014073856
Directory
---------
mtpindex.dat 0
System Volume Information/
WPSettings.dat 12
IndexerVolumeGuid 76
zarathustra.mp3 489461
2001/
calculations.wav 426300
completed.wav 276460
dangerous_to_remain.wav 372892
enough_info.wav 513388
functional.wav 237356
one_moment.wav 202236
operational.wav 772140
sorry_dave.wav 791164
stop.wav 200844
Audacity/
Away_in_a_Manger.mp3 2014737
Dont_Rain_on_My_Parade.mp3 3944449
Take_My_Breathe_Away.mp3 5740819
Welcome_Christmas.mp3 2985790
FLAC/
T1_1024.FLA 9802802
T1_128.FLA 11126659
T1_256.FLA 10415954
T1_512.FLA 10007370
Candyman.aac 3177823
Dont Rain on My Parade.mp3 3944449
odd1.mp3 46888
odd1.wav 553004
Playing file: odd1.mp3
Playing(1) file: 'odd1.mp3'
User Abort
Done.
Playing file: 2001/stop.wav
Playing(2) file: '2001/stop.wav'
Audio Error: 1
*** Start Interval Timer ***
Date: 4 Dec 2021 7:31:29
void unused_interrupt_vector(void)
{
uint32_t i, ipsr, crc, count;
const uint32_t *stack;
struct arm_fault_info_struct *info;
const uint32_t *p, *end;
// disallow any nested interrupts
__disable_irq();
// store crash report info
asm volatile("mrs %0, ipsr\n" : "=r" (ipsr) :: "memory");
info = (struct arm_fault_info_struct *)0x2027FF80;
info->ipsr = ipsr;
asm volatile("mrs %0, msp\n" : "=r" (stack) :: "memory");
info->cfsr = SCB_CFSR;
info->hfsr = SCB_HFSR;
info->mmfar = SCB_MMFAR;
info->bfar = SCB_BFAR;
info->ret = stack[6];
info->xpsr = stack[7];
info->temp = tempmonGetTemp();
info->time = rtc_get();
info->len = sizeof(*info) / 4;
// add CRC to crash report
crc = 0xFFFFFFFF;
p = (uint32_t *)info;
end = p + (sizeof(*info) / 4 - 1);
while (p < end) {
crc ^= *p++;
for (i=0; i < 32; i++) crc = (crc >> 1) ^ (crc & 1)*0xEDB88320;
}
info->crc = crc;
////////////////////////////////////////////////
printf("\n >>>>> unused_interrupt_vector <<<<<\n");
printf(" Code was executing from address 0x%x\n", info->ret);
printf(" CFSR: %x\n", info->cfsr);
if (((info->cfsr & (0x80)) >> 7) == 1) printf("\t(MMARVALID) Accessed Address: 0x%x\n", info->mmfar);
printf(" XPSR: %x\n", info->xpsr);
printf(" HFSR: %x\n", info->hfsr);
printf(" STACK: %x\n", (uint32_t)stack);
for (uint16_t i = 0; i < 32; i+=4) printf("\t %x %x %x %x\n", stack[-i],stack[-i-1], stack[-i-2],stack[-i-3]);
////////////////////////////////////////////////
arm_dcache_flush_delete(info, sizeof(*info));
...
>>>>> unused_interrupt_vector <<<<<
Code was executing from address 0x0000A1B2
CFSR: 00000082
(MMARVALID) Accessed Address: 0x200179E1
XPSR: 010F0056
HFSR: 00000000
STACK: 20047E80
0000005D 00000000 0000000A 20047E80
2000AF24 0002DCA7 20047E80 2027FF80
20047E60 20047E84 2018101B 13110D0C
00000008 20047F48 00000049 00000000
00000000 20047EAC 00000001 000F4240
00000000 0000E731 00000000 00000001
20047E88 00000019 00000000 00000000
20047E88 20047F48 00000000 00000000
need to switch to alternate clock during reconfigure of ARM PLL
USB PLL is running, so we can use 120 MHz
Freq: 12 MHz * 66 / 4 / 1
ARM PLL=80002064
ARM PLL needs reconfigure
ARM PLL=80002042
New Frequency: ARM=198000000, IPG=99000000
Decreasing voltage to 1150 mV
and doing:
[CODE]
C:\Users\kurte\AppData\Local\Temp\arduino_build_MTP_TEST_AUDIO.ino>addr2line -e MTP_TEST_AUDIO.ino.elf 0x0000A1B2
C:\Users\kurte\Documents\Arduino\libraries\Audio/play_sd_wav.cpp:477
C:\Users\kurte\AppData\Local\Temp\arduino_build_MTP_TEST_AUDIO.ino>
case '\n':
case 'h': menu(); break;
}
while (DBGSerial.read() != -1) ; // remove rest of characters.
} else {
#if USE_MSC == 1
checkMSCChanges();
#endif
mtpd.loop();
}
<THIS BLANK LINE IS LINE 477>
if (write_data) {
while (playMp31.isPlaying()) {
x Can’t automatically merge. Don’t worry, you can still create the pull request.
<<<<<<< FS_Usage
}while((int64_t) pagehdr->granuleposition == -1 || pagehdr->granuleposition <= granulePos);
=======
}while((int64_t)pagehdr->granuleposition == -1 || pagehdr->granuleposition <= granulePos);
>>>>>>> master
// These two defines are timeouts for detecting a connected drive
// and waiting for it to be operational.
#define MEDIA_READY_TIMEOUT 1000
#define MSC_CONNECT_TIMEOUT 4000
// These two defines are timeouts for detecting a connected drive
// and waiting for it to be operational.
#define MEDIA_READY_TIMEOUT 5000
#define MSC_CONNECT_TIMEOUT 5000
/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC/src/MassStorageDriver.cpp: In member function 'uint8_t msController::msWriteBlocks(uint32_t, uint16_t, uint16_t, const void*)':
/home/wwatson/arduino-1.8.16/hardware/teensy/avr/libraries/USBHost_t36-FS_Integration_MSC/src/MassStorageDriver.cpp:672:109: warning: invalid conversion from 'const void*' to 'void*' [-fpermissive]
if ((uint32_t)sectorBuffer >= 0x20200000u) arm_dcache_flush(sectorBuffer, (uint32_t)(Blocks * BlockSize));
^
In file included from /home/wwatson/arduino-1.8.16/hardware/teensy/avr/cores/teensy4/core_pins.h:32:0,
from /home/wwatson/arduino-1.8.16/hardware/teensy/avr/cores/teensy4/wiring.h:39,
from /home/wwatson/arduino-1.8.16/hardware/teensy/avr/cores/teensy4/WProgram.h:45,
from /tmp/arduino_build_646435/pch/Arduino.h:6:
/home/wwatson/arduino-1.8.16/hardware/teensy/avr/cores/teensy4/imxrt.h:9907:20: note: initializing argument 1 of 'void arm_dcache_flush(void*, uint32_t)'
static inline void arm_dcache_flush(void *addr, uint32_t size)
arm_dcache_flush([COLOR="#FF0000"](void *)[/COLOR]sectorBuffer, (uint32_t)(Blocks * BlockSize));
Yes I thought I pushed up change for the cast
Thanks for a great AudioCodec library@wwatson,
Thank you for the PR
@All - Just ran into a problem with playing wav files. If the file size is > ~60meg it will not play with recent changes to Audio library. Any thing less than 60meg and it plays. I have a 102meg wav file that plays with @FrankB's Teensy-WavePlayer I had originally modified it to play wav files with DiskIOMB. It worked with all wav file sizes. When I try to play the same files with the modified wav player files in the Audio library they will not play. I remember back when I first had it playing with MSC I had to increase the buffer size from 512 to 8192 to get it to play. Tried that and it still failed.
It's getting late and I I'm kinda burnt out. Been messing with this all day. I also saw similar issues on the other thread. More tommorow...