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

Thread: I2c scanner doesn't find audio board

  1. #1
    Senior Member
    Join Date
    Nov 2015
    Posts
    148

    I2c scanner doesn't find audio board

    I have a custom protoboard, all works but the audio board is not recognized... I just ordered a new board, and nothing... The board is not on top of the teensy (see the pic) i have double checked the connections. All is correct.

    I have an LCD with 0x3c address and one ht16k33 with 0x70...

    Click image for larger version. 

Name:	6jempw.jpg 
Views:	34 
Size:	150.4 KB 
ID:	12126
    Last edited by urbanspaceman; 11-30-2017 at 06:26 PM.

  2. #2
    Senior Member
    Join Date
    Nov 2015
    Posts
    148
    Solved uploading an audio sketch.. the board works fine!

  3. #3
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,572
    you need the codec on for I2C to be enabled, so to scanner add 2 lines

    #include <Audio.h>
    AudioOutputI2S audioOutput;


    https://forum.pjrc.com/threads/42814...-shows-nothing

  4. #4
    Senior Member
    Join Date
    Nov 2015
    Posts
    148
    Thanks Manitou
    when i add these two line of code, i get error..

    complete code is

    Code:
    // -------------------------------------------------------------------------------------------
    // I2C Bus Scanner
    // -------------------------------------------------------------------------------------------
    //
    // This creates an I2C master device which will scan the address space and report all
    // devices which ACK.  It does not attempt to transfer data, it only reports which devices
    // ACK their address.
    //
    // Pull the control pin low to initiate the scan.  Result will output to Serial.
    //
    // This example code is in the public domain.
    // -------------------------------------------------------------------------------------------
    
    #include <i2c_t3.h>
    #include <Audio.h>
    AudioOutputI2S audioOutput;
    
    // Function prototypes
    void print_scan_status(uint8_t target, uint8_t all);
    
    uint8_t found, target, all;
    
    void setup()
    {
        pinMode(LED_BUILTIN,OUTPUT);    // LED
        pinMode(12,INPUT_PULLUP);       // pull pin 12 low to show ACK only results
        pinMode(11,INPUT_PULLUP);       // pull pin 11 low for a more verbose result (shows both ACK and NACK)
    
        // Setup for Master mode, pins 18/19, external pullups, 400kHz, 10ms default timeout
        Wire.begin(I2C_MASTER, 0x00, I2C_PINS_18_19, I2C_PULLUP_EXT, 400000);
        Wire.setDefaultTimeout(10000); // 10ms
    
        Serial.begin(115200);
    }
    
    void loop()
    {
        // Scan I2C addresses
        //
        if(digitalRead(12) == LOW || digitalRead(11) == LOW)
        {
            all = (digitalRead(11) == LOW);
            found = 0;
            
            Serial.print("---------------------------------------------------\n");
            Serial.print("Starting scan...\n");
            digitalWrite(LED_BUILTIN,HIGH); // LED on
            for(target = 1; target <= 0x7F; target++) // sweep addr, skip general call
            {
                Wire.beginTransmission(target);       // slave addr
                Wire.endTransmission();               // no data, just addr
                print_scan_status(target, all);
            }
            digitalWrite(LED_BUILTIN,LOW); // LED off
    
            if(!found) Serial.print("No devices found.\n");
            
            delay(100); // delay to space out tests
        }
    }
    
    //
    // print scan status
    //
    void print_scan_status(uint8_t target, uint8_t all)
    {
        switch(Wire.status())
        {
        case I2C_WAITING:  
            Serial.printf("Addr: 0x%02X ACK\n", target);
            found = 1;
            break;
        case I2C_ADDR_NAK: 
            if(all) Serial.printf("Addr: 0x%02X\n", target); 
            break;
        default:
            break;
        }
    }
    and... when the audio board is plugged, the lcd remain black

  5. #5
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,572
    Use the Scanner example from the Wire library. (audio stuff doesn't use i2c_t3)
    Last edited by manitou; 12-04-2017 at 11:23 AM.

  6. #6
    Senior Member
    Join Date
    Nov 2015
    Posts
    148
    Works well! 3 device found!
    maybe the black display is a similar problem?
    i use the U8g2 library

  7. #7
    Senior Member
    Join Date
    Nov 2015
    Posts
    148
    With the wire lib the display works fine.
    The U8g2 seems better for fonts/graphics

Tags for this Thread

Posting Permissions

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