Audio Library AudioPlaySerialflashRaw Help

Status
Not open for further replies.
Hey Everyone,

I'm running experiments for a project I'm working on. It involves using the Teensy 4.1, Prop Shield, 0.96 inch OLED display, Adafruit UDA1334 I2S DAC, and Dotstar LED strip. I've attached the code I'm working with.

Just a note on hardware setup the flash chip and LED's are on the SPI bus (prop shield), the OLED is on the SPI1 bus. The DAC is on I2S2 (I removed the prop shield's IRQ pin in order to allow this as I'm not using it right now and plan to attach it somewhere else later since it interferes with I2S2).

The problem I'm having is in the sketch where I have all of them working together (LED_TEST.ino) I cannot get the RAW file to play. When attempting to play it the sketch freezes. When playing from the SD Card (using AudioPlaySdWav instead of AudioPlaySerialflashRaw) I don't run into this issue.

I made a separate sketch to test it by itself (Flash-Audio-Test.ino) with all the same settings and setup and it plays without any issues. Am I blind and missing some sort of incorrect code in the LED_TEST.ino sketch or is there something I need to do in order to make AudioPlaySerialflashRaw play nice with other things on the bus (LED's)? With or without SPI transaction lines I only run into this problem in LED_TEST.ino.

Any help with this would be greatly appreciated, a second set of eyes may be what I need here lol.
 

Attachments

  • LED_TEST.ino
    5.4 KB · Views: 52
  • Debounce_Button.h
    1,002 bytes · Views: 47
  • LED_Animations.h
    5.1 KB · Views: 56
  • Flash-Audio-Test.ino
    1.2 KB · Views: 44
I did a little more testing, using SPI transactions in Flash-Audio-Test.ino results in the sound being able to be played once but no more afterward. The SPI transactions were necessary in LED_Test.ino in order to make the LED strip function correctly, without them I get random output on the strip. Is there maybe some strange interaction with the Audio library and SPI transactions?
 
So I ran a few more tests and I've boiled it down to 2 issues:

1)I'm using the Adafruit_DotStar library which in it's current form does not play well with SPI Transactions. I dug through the source code and came across this: "note This library is written in pre-SPI-transactions style and needs some rewriting to correctly share the SPI bus with other devices." I'll probably have to modify the library (or write a new one myself, which may be beneficial), unless FastLED now supports T4.1.

2)After commenting out the LED loop in my code the sound plays. However attempting to use SPI Transactions with it and it only plays once and then no more, just like in Flash-Audio-Test.ino.

I want to assume the second problem is due to the Audio library already implementing SPI transactions, but I won't know until I dig through that or someone tells me otherwise. I'll keep updating my findings for posterity at this point lol.
 
Switched over to the FastLED library, everything is working simultaneously now. Slight glitching on the LED's when I activate the sound but its barely noticeable. Don't need to use SPI transaction lines, seems that both FastLED and Audio library take care of it correctly. So take it from my incredibly long post, if you need to use multiple things on the SPI bus do not use the Adafruit Dotstar library, use FastLED.
 
Status
Not open for further replies.
Back
Top