VS1053b timer interrupt stops triggering on playback?

Writing software that inputs and/or outputs audio and performs DSP algorithms such as filters, new codecs or audio effects.
awong
User
Posts: 1
Joined: Tue 2016-10-18 9:45

VS1053b timer interrupt stops triggering on playback?

Postby awong » Tue 2016-10-18 9:59

Hello!

I'm have an Adafruit Music Maker Breakout board with a VS1053 on it. It's being driven by a Sparkfun Arduino Mini Pro.

I'm attempting to use the VS1053's GPIO pins to drive some LEDs using either TIMER1 or TIMER0 to generate a PWM signal to the LEDs while the DSP is decoding back mp3 audio. To start though, I just tried blinking an LED at a constant rate based on the timer.

I was successfully able to write a plugin and in it, configure the TIMER1 during APPL_RESET. The LED seems to blink correctly until decode starts. Then it looks like the interrupt for the timer just stops firing. Any idea what might be happening?

Here's my ISR's C routine is:

Code: Select all

void PwmInterrupt(void) {
  static u_int16 pwmCount = 1;
  u_int16 val = USEX(GPIO_ODATA);
  if (pwmCount == 1 ) {
    val &= ~(1 << 5);
    pwmCount = 0;
  } else {
    val |= (1 << 5);
    pwmCount = 1;
  }
  USEX(GPIO_ODATA) = val;
}


The ISR's stub routine was taken from http://www.vlsi.fi/fileadmin/manuals_gu ... p4_ump.pdf section 5.4.1 (btw, I think there's an error in the last 3 of ASM lines...I think it should be working in X space to be consistent with the rest of the stub code).

User avatar
Henrik
VLSI Staff
Posts: 979
Joined: Tue 2010-06-22 14:10

Re: VS1053b timer interrupt stops triggering on playback?

Postby Henrik » Tue 2016-10-18 10:38

Hello!

Welcome to our forums, and congratulations on getting right to the advanced topic of assembler programming!

This may seem like a stupid question, but you don't by any chance happen to set SM_RESET in SCI_MODE register before starting decoding? If you do that, VS1053b will be reset and your timer interrupt will be lost.

You are correct that the example in the VS_DSP4 manual isn't directly usable in VS1053b because the VS1053b hardware registers lie in X memory. (The code isn't incorrect, though.)

To make the example code work for VS1053b, you will need to change all lines where there are comments like "If registers in X space". This means the last lines as you noticed, but also the first line:

Code: Select all

_int_routine0:
  STY i7,(i6); STX mr0,(i6)+1 // Registers in X space
  [... unchanged until three last lines ...]
  LDX (i6),mr0  // Registers in X space
  RETI
  STX i7,(i7); LDY (i6)-1,i7 // Registers in X space


If also the first line isn't changed, a crash will almost certainly happen because the interrupt may destroy the contents of the mode register MR0.

Kind regards,
- Henrik
Good signatures never die. They just fade away.


Return to “DSP and Audio Software”

Who is online

Users browsing this forum: No registered users