VS1053 RT MIDI stops playing randomly :(

Writing software for systems that use VLSI Solution's devices as slave codecs to a host microcontroller.
av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 6:44

Hi there,

I have an application where I feed realtime MIDI data to a VS1053B from my host microcontroller via SDI. since the DREQ pin is not being serviced in RT MIDI mode, I have no way of telling when the chip can accept more MIDI data.

What I am seeing is that from time to time MIDI decoding stops and the chip needs a reset to go output sound again

I have tried both the included RT MIDI mode and also the plugin download that is supposed to have a larger buffer - or is that only on UART but not on SDI?

so my question is, what can I do to make sure that I don't get RT MIDI into a state where it stops working? is there a maximum data rate I can send data over SDI? can I check the MIDI buffer fill status via a SCI maybe? I tried to read the DREQ status over SCI (and when I do that I see the DREQ line actually going low), but then I observe that sometimes the bit is low for a long time even if I feed little data.

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 7:18

Hi there,

I'm feeding realtime MIDI data to the VS1053 from my microcontroller via SDI (not UART)

what I see is that from time to time the VS1053 "locks up" and stops generating sound, then I need to reboot or reset to make it work again

this happens both with the regular rtmidi start patch and with the new plugin that is supposed to have a larger buffer.

I understand that the DREQ line is not being used in this mode, so how can I make sure not to overload the chip? can I read the buffer fill status via SDI maybe? I tried to read the DREQ status bit, but I am not sure it even reflects the buffer status in this case.

User avatar
pasi
VLSI Staff
Posts: 1405
Joined: Thu 2010-07-15 16:04

Re: VS1053 RT MIDI stops playing randomly :(

Post by pasi » Wed 2016-06-15 11:45

Hi,

The interrupt hander that performs data receive is essentially the same for UART and SDI. It thus does not update the DREQ state according to the fill state.

In the vs1053 rtmidi app you could try to monitor the FIFO pointers from Y:0x1800 and Y:0x1801. I.e. write 0x5800 to SCI_WRAMADDR, then read SCI_WRAM twice. The first word read is the write pointer, the second one is the read pointer. The fill state is wrPtr-rdPtr, add 128 if negative. Let me know what kind of values you see.

Also check that CVDD is 1.8V and SCI_CLOCKF is within valid clock limits.

You are not sending any system exclusive messages, right?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

Re: VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 13:26

Hi Pasi,

- no Sysex messages
- CVDD is 1.8V
- CLOCKF is 0xC000

running:

Code: Select all

	
	SCI_write(WRAMADDR, 0x5800);
	uint16_t wrp = SCI_read(WRAM);
	uint16_t rdp = SCI_read(WRAM);
	xprintf("[%04X %04X]\n", wrp, rdp);
before each 4 or 6 byte SDI transfer yields:
[FFFF 082A]
[0000 1C2C]
[0000 182F]
[FFFF 1832]
[0000 0000]
[0000 1C37]
[FFFF 181A]
[0000 1C1C]
[0000 181F]
[0000 1842]
[0000 1C65]
[FFFF 0847]
[FFFF 1C4A]
[FFFF 084D]
[0000 FFFF]
[FFFF 1C52]
[0000 1857]
[FFFF 1857]
[FFFF 181A]
[0000 187C]
[FFFF 1860]
[0000 1822]
[0000 1865]
[FFFF 1868]
[FFFF 0000]
does not look like FIFO pointers to me

User avatar
pasi
VLSI Staff
Posts: 1405
Joined: Thu 2010-07-15 16:04

Re: VS1053 RT MIDI stops playing randomly :(

Post by pasi » Wed 2016-06-15 13:54

Have you loaded the rtmidi53 plugin (rtmidi1053b.c from VS1003b/VS1033c/VS1053b Real-Time MIDI Input Application)? ( http://www.vlsi.fi/en/support/software/ ... tions.html )
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

Re: VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 14:26

yes, I did:

Code: Select all

static const unsigned short plugin_long[628] = {
	0x0007, 0x0001, 0x8050, 0x0006, 0x0004, 0x2800, 0x4940, 0x0006,	/*    0 */
	...
but now I question my SCI_read() command, let me make sure that works as it should...

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

Re: VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 14:56

ok, there is something strange with my SPI drivers, but I can confirm that I see the FIFO pointers advance by 3 with every NOTE_ON I send. now let me what I can debug with that

User avatar
pasi
VLSI Staff
Posts: 1405
Joined: Thu 2010-07-15 16:04

Re: VS1053 RT MIDI stops playing randomly :(

Post by pasi » Wed 2016-06-15 15:22

Now, when the midi decoding seems to get stuck, what are the values of the read and write pointers?

Is DECODETIME still advancing? What do the other SCI registers contain?
Visit https://www.facebook.com/VLSISolution VLSI Solution on Facebook

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

Re: VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 15:28

I will have a look at that once I get my SPI driver fixed - now I get good looking values for the fifo pointers, but in return the drivers gets stuck before the VS1053 does :)

av500
User
Posts: 14
Joined: Tue 2016-06-14 18:00

Re: VS1053 RT MIDI stops playing randomly :(

Post by av500 » Wed 2016-06-15 16:01

ok, here is what happens (printing wrp, rdp and FIFO fill)
...
[1845 1847 126]
[1848 184A 126]
[184B 184D 126]
[184E 1850 126]
..FIFO overflows here...
[1857 1854 3]
[185A 1854 6]
[185D 1854 9]
[1860 1854 12]
[1863 1854 15]
...
so when I "flood" the chip with MIDI data, the FIFO starts to fill and when it overflows once the 2nd pointer never advances any more and no more MIDI.

since I can now read the FIFO state I can prevent from happening that of course.

Post Reply

Who is online

Users browsing this forum: No registered users