It works for file-number specified play, counting file numbers on SD, and other functions,
however, the playing by specifying file name always results in playing the first file on SD.
The code for playing is follows. The contents of filename written(1) and the read-out written file name(2) are identical, such as "12345678MP3". (I confirmed the char[] to word[] padding by the code descibed in "5.2 Reading the 8.3-character Filename" in standalone player's datasheet PDF. It is OK).
Although the result of VS_AICTRL0 register gets 0, which means OK (file located), but the contents of WRAM read is always the filename of the first file on SD, even if the specified filename is wrong (non-existing filename)
I appreciate any advice for modifying the code to operate correctly.
Code: Select all
// (1)writing filename
WriteVS10xxRegister(VS_WRAMADDR, 0x4780);
for (i = 0; i < 6; i++) WriteVS10xxRegister(VS_WRAM, name[i]);
// (2)reading written filename
WriteVS10xxRegister(VS_WRAMADDR, 0x4780);
for (i = 0; i < 6; i++) uint16_t w = ReadVS10xxRegister(VS_WRAM);
WriteVS10xxRegister(VS_AICTRL3, (1 << 8) | 0x14); // set CTRL3_BY_NAME bit
WriteVS10xxRegister(VS_AICTRL0, 0xffff); // start
wait(1); // wait for a while
printf("result=%d\r\n", ReadVS10xxRegister(VS_AICTRL0)); // gets 0 (OK)
// (3)reading located filename
WriteVS10xxRegister(VS_WRAMADDR, 0x4780);
for (i = 0; i < 6; i++) uint16_t w = ReadVS10xxRegister(VS_WRAM);