Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Startup/hard reset problem.

Threaded View

  1. #1

    Startup/hard reset problem.

    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.

    #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(){ 
      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");   
      Serial.println("setting audio memory");
      Serial.println("sgtl volume set");   
      delay(1000); //necessary wait for serial port to open
      /* Initialise the sensor */
                        {    /* There was a problem detecting the BNO055 ... check your connections */
                          Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
     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 by Daniel-J; 10-29-2017 at 05:08 AM. Reason: add Digikey link for eeprom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts