I've got a little board I designed that has these things on it:
- Teensy 3.2
- SGTL5000
- S25FL256S flash eeprom (link to Digikey page)
- BNO055 position sensor board
These are used to play back some sounds (in 8 channels, WOW!) that are stored on the flash. It works great! The hardware, the software etc all work.
Except... there is a catch. It will only work with a reset of the Teensy ARM chip, either by the USB port after upload, or thorugh the little Reset pad on the bottom side of the board.
I'm pretty sure that this has to do with the different startup times for the first three chips above. Once they are all powered up, a hard reset on the teensy always starts the other two properly. Since the guitar synth example code fromt he audio library works perfectly without any problems, I am guessing that it's the interaction between the S25FL256S flash eeprom, SerialFlash.h and the Teensy that is going wrong.
On the other hand, with hard reset I get a click in the headphoens after sgtl50000_enable(), and when it fails I don't hear a click. So it could be to do with the sgtl5000 as well.
I've added delays galore to the setup() function but am not getting anywhere... any ideas? Help is appreciated! Setup code is below.
- Teensy 3.2
- SGTL5000
- S25FL256S flash eeprom (link to Digikey page)
- BNO055 position sensor board
These are used to play back some sounds (in 8 channels, WOW!) that are stored on the flash. It works great! The hardware, the software etc all work.
Except... there is a catch. It will only work with a reset of the Teensy ARM chip, either by the USB port after upload, or thorugh the little Reset pad on the bottom side of the board.
I'm pretty sure that this has to do with the different startup times for the first three chips above. Once they are all powered up, a hard reset on the teensy always starts the other two properly. Since the guitar synth example code fromt he audio library works perfectly without any problems, I am guessing that it's the interaction between the S25FL256S flash eeprom, SerialFlash.h and the Teensy that is going wrong.
On the other hand, with hard reset I get a click in the headphoens after sgtl50000_enable(), and when it fails I don't hear a click. So it could be to do with the sgtl5000 as well.
I've added delays galore to the setup() function but am not getting anywhere... any ideas? Help is appreciated! Setup code is below.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BNO055.h>
#include <utility/imumaths.h>
// GUItool: begin automatically generated code
AudioPlaySerialflashRaw playFlashRaw6; //xy=132,327
AudioPlaySerialflashRaw playFlashRaw1; //xy=135,82
AudioPlaySerialflashRaw playFlashRaw3; //xy=135,179
AudioPlaySerialflashRaw playFlashRaw5; //xy=135,277
AudioPlaySerialflashRaw playFlashRaw7; //xy=135,376
AudioPlaySerialflashRaw playFlashRaw4; //xy=136,227
AudioPlaySerialflashRaw playFlashRaw2; //xy=137,127
AudioPlaySerialflashRaw playFlashRaw8; //xy=139,421
AudioMixer4 mixer3; //xy=356,330
AudioMixer4 mixer2; //xy=368,155
AudioMixer4 mixer1; //xy=484,242
AudioOutputI2S i2s1; //xy=679,244
AudioConnection patchCord1(playFlashRaw6, 0, mixer3, 1);
AudioConnection patchCord2(playFlashRaw1, 0, mixer2, 0);
AudioConnection patchCord3(playFlashRaw3, 0, mixer2, 2);
AudioConnection patchCord4(playFlashRaw5, 0, mixer3, 0);
AudioConnection patchCord5(playFlashRaw7, 0, mixer3, 2);
AudioConnection patchCord6(playFlashRaw4, 0, mixer2, 3);
AudioConnection patchCord7(playFlashRaw2, 0, mixer2, 1);
AudioConnection patchCord8(playFlashRaw8, 0, mixer3, 3);
AudioConnection patchCord9(mixer3, 0, mixer1, 3);
AudioConnection patchCord10(mixer2, 0, mixer1, 0);
AudioConnection patchCord11(mixer1, 0, i2s1, 0);
AudioConnection patchCord12(mixer1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;
// GUItool: end automatically generated code
/* BNO055 setup */
#define BNO055_SAMPLERATE_DELAY_MS (100)
Adafruit_BNO055 bno = Adafruit_BNO055();
#define movementThreshold 0.01
#define FLASH_CHIP_SELECT 6
#define SDCARD_CS_PIN 10
#define SDCARD_MOSI_PIN 7
#define SDCARD_SCK_PIN 14
void setup(){
delay(1000);
SPI.setSCK(14); // Audio shield has SCK on pin 14
SPI.setMOSI(7); // Audio shield has MOSI on pin 7
Serial.println("mosi pins set");
delay(1000);
AudioMemory(8);
Serial.println("setting audio memory");
sgtl5000_1.enable();
delay(1000);
sgtl5000_1.volume(0.6);
Serial.println("sgtl volume set");
delay(1000);
playFlashRaw1.begin();
delay(500);
Serial.begin(9600);
delay(1000); //necessary wait for serial port to open
/* Initialise the sensor */
if(!bno.begin())
{ /* There was a problem detecting the BNO055 ... check your connections */
Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
while(1);
}
bno.setExtCrystalUse(true);
if (!SerialFlash.begin(FLASH_CHIP_SELECT)) {
while (1) {
Serial.println ("Cannot access SPI Flash chip");
}
} else {
Serial.println ("OK access to SPI Flash chip");
}
Serial.println("finished setup");
}
Last edited: