VS1053 Adafruit library 'player_simple' example doesn't compile for Teensy 4.1

thecomfychair

Active member
I'm trying to use the Adafruit_VS1053 library which is included with Teensyduino 1.56 on a Teensy 4.1. Unfortunately, the player_simple example does not compile, returning these errors:

Code:
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp: In member function 'void Adafruit_VS1053_FilePlayer::feedBuffer()':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp:218:14: error: 'SREG' was not declared in this scope
   sregsave = SREG;
              ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp: In constructor 'Adafruit_VS1053::Adafruit_VS1053(int8_t, int8_t, int8_t, int8_t, int8_t, int8_t, int8_t)':
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp:280:14: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
   clkportreg = portOutputRegister(digitalPinToPort(_clk));
              ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp:282:15: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
   misoportreg = portInputRegister(digitalPinToPort(_miso));
               ^
C:\Program Files (x86)\Arduino\hardware\teensy\avr\libraries\Adafruit_VS1053\Adafruit_VS1053.cpp:284:15: error: cannot convert 'volatile uint32_t* {aka volatile long unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in assignment
   mosiportreg = portOutputRegister(digitalPinToPort(_mosi));
               ^

The SREG error disappears if I use the latest version of the library from Adafruit (downloaded using the Arduino Library Manager). However, the conversion issues remain.

The errors disappear if I change the board to a Teensy 3.6, so I'm guessing this is a AVR vs ARM issue - beyond that it's well above my head unfortunately!

Has anyone tried to port this to a T4.1?

Otherwise, can anyone recommend another library to use for the VS1053?
(I'm not using the Adafruit breakout board since we already have an SD reader on the T4.1)
 
You are correct, I'm now attempting to use this library which asks you to comment out any references to SREG if using a T4.1.

The example in this new library does compile but I'm yet to get any audio out of the headphone jack - will post this in a separate topic though.
 
Back
Top