• AVR Freaks

Hot!I2C BUS SNOOPER (Inter - Integrated Circuit)

Author
Gort2015
Klaatu Barada Nikto
  • Total Posts : 3835
  • Reward points : 0
  • Joined: 2015/04/30 10:49:57
  • Location: 0
  • Status: offline
2020/03/09 00:36:31 (permalink)
5 (2)

I2C BUS SNOOPER (Inter - Integrated Circuit)

I2C BUS SNOOPER v2.0 (Inter - Integrated Circuit)
Example output from updated version
 
I2C Bus Snooper v2.0
=== === ======= ====

BUS     A10     CHIPID  Name
---     ---     ------  ----
 1               50     MB85RC
 1               68     AMG8833 DS1307 DS3231 ICM-20649 ITG3200 MPU-9250 MPU-60X0 PCF8523
 1      *       2C8
 1      *       2C9
 1      *       2CA
 1      *       2CB
 1      *       3C8
 1      *       3C9
 1      *       3CA
 1      *       3CB

Device Count 10



post edited by Gort2015 - 2020/03/09 00:37:36

MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
https://www.youtube.com/watch?v=Iu1qa8N2ID0
+ ST:Continues, "What Ships are Made for", Q's back.
#1

14 Replies Related Threads

    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 09:13:46 (permalink)
    0
    After the program has ran, results can be printed to stdout.
    I added names at the last minute.
     
    This is the structure for each I2C device:
    typedef struct{
        unsigned int ChipID :10;   // 7 bit or 10 bit chip ID
        unsigned int A10    : 1;   // Clear: 7 bit, Set: 10 bit
        unsigned int BUS    : 4;   // 1 - 16 buses (Modules + bitbang + routing)
        unsigned int unused : 1;
    }I2C_t;

     
     
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #2
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 09:41:33 (permalink)
    0
    "sprintf" and "echo" can be replaced with "printf".
    void runsnoop_forever(){
        int     cnt;
        I2C_t   i2cbuf[20];   // e.g. 20 devices connected
        char    txtbuf[200];  // text buffer
        
        for(;;) {
            // 4 second delay
            tdel(40);
            // - - - - - - - - - - - - - - - -
            // blink led before I2C bus scan
            LATAbits.LATA0 = 1; tdel(1);
            LATAbits.LATA0 = 0; tdel(1);
            // - - - - - - - - - - - - - - - -
            // intro and column header to stdout
            sprintf(txtbuf, "I2C Bus Snooper v2.0\r=== === ======= ====\r\r");
            echo;
            sprintf(txtbuf, "BUS\tA10\tCHIPID\tName\r---\t---\t------\t----\r");
            echo;
            // - - - - - - - - - - - - - - - -
            // run snooper
            cnt = i2c_snooper_v2(i2cbuf);
            // - - - - - - - - - - - - - - - -
            // print results to stdout
            for(int idx = 0; idx < cnt; idx++){
                sprintf (txtbuf,
                    "%2u\t%c\t%3X\t",
                    i2cbuf[idx].BUS,
                    i2cbuf[idx].A10 ? '*' : 0x20,
                    i2cbuf[idx].ChipID
                );
                echo;
                // - - - - - - - - - - - - - - - -
                // only 7 bit addresses have names
                if(i2cbuf[idx].A10) {
                    txtbuf[0] = 0xd; txtbuf[1] = 0x0;
                }else
                    sprintf (txtbuf, "%s\r", idname[i2cbuf[idx].ChipID - 0x10]);
                echo;
            }
            // - - - - - - - - - - - - - - - -
            // count to stdout
            sprintf(txtbuf, "\rDevice Count %i\r", cnt);
            echo;
        }
        // Job Done
        // - - - - - - - - - - - - - - - -
    }

    post edited by Gort2015 - 2020/03/09 10:17:52

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #3
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 10:00:42 (permalink)
    0
    The I2C Name Database Shortened Version (no chip details)
           // 7 Bit Chip ID Device Names
       
    const char *idname[] =  {
            // 0x10
            "VEML6075 VEML7700",
            // - - - - - - - - - - - - - - - -
            // 0x11
            "Si4713",
            // - - - - - - - - - - - - - - - -
            // 0x12 BLANK
            "",
            // - - - - - - - - - - - - - - - -
            // 0x13
            "VCNL40x0",
            // - - - - - - - - - - - - - - - -
            // 0x14 - 0x17 BLANK
            "",
            "",
            "",
            "",
            // - - - - - - - - - - - - - - - -
            // 0x18
            "MCP9808 LIS3DH",
            // - - - - - - - - - - - - - - - -
            // 0x19
            "MCP9808 LIS3DH LSM303",
            // - - - - - - - - - - - - - - - -
            // 0x1A
            "MCP9808",
            // - - - - - - - - - - - - - - - -
            // 0x1B
            "MCP9808",
            // - - - - - - - - - - - - - - - -
            // 0x1C
            "LIS3MDL MCP9808 MMA845x FXOS8700 MMA7455L",
            // - - - - - - - - - - - - - - - -
            // 0x1D
            "MCP9808 MMA845x FXOS8700 LSM9DS0 ADXL345 MMA7455L",
            // - - - - - - - - - - - - - - - -
            // 0x1E
            "FXOS8700, HMC5883, LIS2MDL, LIS3MDL, LSM303, LSM9DS0, MCP9808",
            // - - - - - - - - - - - - - - - -
            // 0x1F
            "MCP9808 FXOS8700",
            // - - - - - - - - - - - - - - - -
            // 0x20
            "FXAS21002 Chirp! MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x21
            "FXAS21002 MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x22
            "MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x23
            "MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x24
            "MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x25
            "MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x26
            "MCP23008 MCP23017 MSA301",
            // - - - - - - - - - - - - - - - -
            // 0x27
            "MCP23008 MCP23017",
            // - - - - - - - - - - - - - - - -
            // 0x28
            "BNO055 CAP1188 DS3502 PCT2075 TSL2591",
            // - - - - - - - - - - - - - - - -
            // 0x29
            "BNO055 DS3502 PCT2075 TCS34725 TSL2561 TSL2591 VL53L0x VL6180X CAP1188",
            // - - - - - - - - - - - - - - - -
            // 0x2A
            "CAP1188 DS3502 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x2B
            "CAP1188 DS3502 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x2C
            "CAP1188 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x2D
            "CAP1188 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x2E
            "PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x2F BLANK
            "",
            // - - - - - - - - - - - - - - - -
            // 0x30 - 0x32 BLANK
            "",
            "",
            "",
            // - - - - - - - - - - - - - - - -
            // 0x33
            "MLX90640",
            // - - - - - - - - - - - - - - - -
            // 0x34 - 0x37 BLANK
            "",
            "",
            "",
            "",
            // - - - - - - - - - - - - - - - -
            // 0x38
            "VEML6070 FT6x06",
            // - - - - - - - - - - - - - - - -
            // 0x39
            "TSL2561 VEML6070 APDS-9960",
            // - - - - - - - - - - - - - - - -
            // 0x3A - 0x3B BLANK
            "",
            "",
            // - - - - - - - - - - - - - - - -
            // 0x3C
            "SSD1305 SSD1306",
            // - - - - - - - - - - - - - - - -
            // 0x3D
            "SSD1305 SSD1306",
            // - - - - - - - - - - - - - - - -
            // 0x3E - 0x3F BLANK
            "",
            "",
            // - - - - - - - - - - - - - - - -
            // 0x40
            "Si7021 HTU21D-F HDC1008 TMP007 TMP006 PCA9685 INA219 INA260",
            // - - - - - - - - - - - - - - - -
            // 0x41
            "HDC1008 TMP007 TMP006 INA219 INA260 STMPE610/STMPE811",
            // - - - - - - - - - - - - - - - -
            // 0x42
            "HDC1008 TMP007 TMP006 INA219",
            // - - - - - - - - - - - - - - - -
            // 0x43
            "HDC1008 TMP007 TMP006 INA219 INA260",
            // - - - - - - - - - - - - - - - -
            // 0x44
            "SHT31 TMP007 TMP006 ISL2912 INA219 INA260 STMPE610/STMPE811",
            // - - - - - - - - - - - - - - - -
            // 0x45
            "SHT31 TMP007TMP006 INA219 INA260",
            // - - - - - - - - - - - - - - - -
            // 0x46
            "TMP007 TMP006 INA219 INA260",
            // - - - - - - - - - - - - - - - -
            // 0x47
            "TMP007 TMP006 INA219 INA260",
            // - - - - - - - - - - - - - - - -
            // 0x48
            "ADS1115 INA219 INA260 PCT2075 PN532 TMP102",
            // - - - - - - - - - - - - - - - -
            // 0x49
            "ADS1115 INA219 INA260 PCT2075 TSL2561 TMP102",
            // - - - - - - - - - - - - - - - -
            // 0x4A
            "ADS1115 INA219 INA260 PCT2075 TMP102",
            // - - - - - - - - - - - - - - - -
            // 0x4B
            "TMP102 ADS1115 INA219 INA260 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x4C
            "INA219 INA260 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x4D
            "INA219 INA260 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x4E
            "INA219 INA260 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x4F
            "INA219 INA260 PCT2075",
            // - - - - - - - - - - - - - - - -
            // 0x50
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x51
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x52
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x53
            "ADXL345 MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x54
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x55
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x56
            "MB85RC",
            // - - - - - - - - - - - - - - - -
            // 0x57
            "MB85RC MAX3010x",
            // - - - - - - - - - - - - - - - -
            // 0x58
            "TPA2016 SGP30",
            // - - - - - - - - - - - - - - - -
            // 0x59 BLANK
            "",
            // - - - - - - - - - - - - - - - -
            // 0x5A
            "MPR121 CCS811 MLX9061x DRV2605",
            // - - - - - - - - - - - - - - - -
            // 0x5B
            "MPR121 CCS811",
            // - - - - - - - - - - - - - - - -
            // 0x5C
            "AM2315 AM2320 LPS25 LPS33HW LPS35HW MPR121",
            // - - - - - - - - - - - - - - - -
            // 0x5D
            "LPS25 LPS33HW LPS35HW MPR121",
            // - - - - - - - - - - - - - - - -
            // 0x5E
            "TLV493D",
            // - - - - - - - - - - - - - - - -
            // 0x5F BLANK
            "",
            // - - - - - - - - - - - - - - - -
            // 0x60
            "MCP4728 MPL115A2 MPL3115A2 Si5351A Si1145 MCP4725A0 TEA5767 VCNL4040",
            // - - - - - - - - - - - - - - - -
            // 0x61
            "Si5351A MCP4725A0",
            // - - - - - - - - - - - - - - - -
            // 0x62
            "MCP4725A1",
            // - - - - - - - - - - - - - - - -
            // 0x63
            "MCP4725A1, Si4713",
            // - - - - - - - - - - - - - - - -
            // 0x64
            "MCP4725A2",
            // - - - - - - - - - - - - - - - -
            // 0x65
            "MCP4725A2",
            // - - - - - - - - - - - - - - - -
            // 0x66
            "MCP4725A3",
            // - - - - - - - - - - - - - - - -
            // 0x67
            "MCP4725A3",
            // - - - - - - - - - - - - - - - -
            // 0x68
            "AMG8833 DS1307 DS3231 ICM-20649 ITG3200 MPU-9250 MPU-60X0 PCF8523",
            // - - - - - - - - - - - - - - - -
            // 0x69
            "AMG8833 ICM-20649 MPU-9250 MPU-60X0 ITG3200",
            // - - - - - - - - - - - - - - - -
            // 0x6A
            "ICM330DHC L3GD20H LSM6DS33 LSM6DSOX LSM9DS0",
            // - - - - - - - - - - - - - - - -
            // 0x6B
            "ICM330DHC L3GD20H LSM6DS33 LSM6DSOX LSM9DS0",
            // - - - - - - - - - - - - - - - -
            // 0x70
            "HT16K33 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x71
            "HT16K33 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x72
            "HT16K33 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x73
            "HT16K33 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x74
            "HT16K33 IS31FL3731 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x75
            "HT16K33 IS31FL3731 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x76
            "BME280 BMP280 HT16K33 IS31FL3731 MS5607/MS5611 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x77
            "BMA180 BME280 BMP280 BMP180 BMP085 HT16K33 IS31FL3731 MS5607/MS5611 PCT2075 TCA9548",
            // - - - - - - - - - - - - - - - -
            // 0x78 - 0x7F  BLANK
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""
        };
    // ----------------------------------------------------


    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #4
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 10:28:18 (permalink)
    0
    0x20 "Chirp!" is a soil moisture sensor I2C.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #5
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 11:09:02 (permalink)
    4.5 (2)
    Here is my I2C Bus Snooper.
    // ----------------------------------------------------
    //
    //
    // I2C Bus Snooper v2.0
    // (c) GORT1951 March 2020
    //
    // "List"
    // Pointer: list of I2C_t
    //
    // Return:  Count of I2C devices found, negative ( -BUS busy )
    //
    //
    #define     BUSY
                ( _I2C1CONL_ACKEN_MASK | _I2C1CONL_RCEN_MASK |
     
                  _I2C1CONL_PEN_MASK   | _I2C1CONL_RSEN_MASK |
                  _I2C1CONL_SEN_MASK
                )
    #define     DISABLE     0
    #define     MAXBUS      1
    #define     I2C_sizeof  (( I2C2CONL - I2C1CONL ) >> 1 )

    int i2c_snooper_v2 (I2C_t *List) {
        // init: create module SFRs (word aligned)
        int             cnt  = 0;
        volatile
        unsigned int   *CONL = &I2C1CONL + 0x00,
                       *STAT = &I2C1CONL + 0x02,
                       *BRG  = &I2C1CONL + 0x08,
                       *TRN  = &I2C1CONL + 0x0A;
        // - - - - - - - - - - - - - - - -
        // null list?
        if (!List) return 0;
        // - - - - - - - - - - - - - - - -
        // I2C bus control
        for (unsigned int BUS = 1; BUS <= MAXBUS; BUS++) {
            // module off
            *CONL &= ~_I2C1CONL_I2CEN_MASK;
            // - - - - - - - - - - - - - - - -
            // disable interrupts for known modules
            if (BUS == 1) IEC1bits.MI2C1IE = DISABLE;
            else if (BUS == 2) IEC2bits.MI2C2IE = DISABLE;
            // - - - - - - - - - - - - - - - -
            //
            // 90 MIPS CPU, I2C @ 100 KHz
            // BRG = (1 / 100,000)
            // ( 0.000,010 - 0.000,000,110 [Delay] ) * 45,000,000 [ Fcy / 2 ] - 2
            //
            *BRG = 443;
            // - - - - - - - - - - - - - - - -
            // module on, disable slew rate @ 100KHz, I2C spec.
            *CONL = _I2C1CONL_I2CEN_MASK | _I2C1CONL_DISSLW_MASK | _I2C1CONL_STRICT_MASK;
            while (*CONL & BUSY);
            // - - - - - - - - - - - - - - - -
            // switch bus, bus may be busy
            if (*STAT & _I2C1STAT_P_MASK) return -BUS;
            // - - - - - - - - - - - - - - - -
            // assert start condition, take bus control
            *CONL |= _I2C1CONL_SEN_MASK;
            while (*CONL & _I2C1CONL_SEN_MASK);
            // - - - - - - - - - - - - - - - -
            // A10: 0 = 7 bit, 1 = 10 bit
            for (unsigned int A10 = 0; A10 <= 1; A10++) {
                // ID range:
                // 1st Pass  7 bit:  $08 -  $77
                // 2nd Pass 10 bit: $000 - $3FF
                // - - - - - - - - - - - - - - - -
                for (unsigned int ID = (A10 ? 0 : 8); ID <= (A10 ? 0x3FF : 0x77); ID++) {
                    // assert repeat start condition
                    while (*CONL & BUSY);
                    *CONL |= _I2C1CONL_RSEN_MASK;
                    // - - - - - - - - - - - - - - - -
                    // wait for repeat start condition to complete
                    while (*CONL & _I2C1CONL_RSEN_MASK);
                    // - - - - - - - - - - - - - - - -
                    // Big Endian Address
                    // 7 bit or 10 bit address ?
                    if (A10) {
                        // try 10 bit address high ID byte + RW = 0
                        // then wait for slave acknowledgement
                        *TRN = 0xF0 | (((ID & 0x300) >> 7));
                        while (*STAT & _I2C1STAT_TRSTAT_MASK);
                        // - - - - - - - - - - - - - - - -
                        // NAK - no response
                        if (*STAT & _I2C1STAT_ACKSTAT_MASK) continue;
                    }
                    // - - - - - - - - - - - - - - - -
                    // try 10 bit address low ID byte or 7 bit ID + RW = 0
                    // then wait for slave acknowledgement
                    *TRN =  ID << (A10 == 0);
                    while (*STAT & _I2C1STAT_TRSTAT_MASK);
                    // - - - - - - - - - - - - - - - -
                    // NAK - no response
                    if (*STAT & _I2C1STAT_ACKSTAT_MASK) continue;
                    // - - - - - - - - - - - - - - - -
                    // ACK, device response
                    // fill structure
                    cnt++;
                    List    -> A10    = A10;
                    List    -> BUS    = BUS;
                    List++  -> ChipID =  ID;
                    // - - - - - - - - - - - - - - - -
                } // - END ID
                // - - - - - - - - - - - - - - - -
            } // - END A10
            // assert stop condition, release bus
            *CONL |= _I2C1CONL_PEN_MASK;
            // - - - - - - - - - - - - - - - -
            // module off (optional)
            // while (*CONL & BUSY);
            // *CONL &= ~_I2C1CONL_I2CEN_MASK;
            // - - - - - - - - - - - - - - - -
            // next module
            CONL += I2C_sizeof;
            STAT += I2C_sizeof;
            BRG  += I2C_sizeof;
            TRN  += I2C_sizeof;
        } // - END BUS
        // - - - - - - - - - - - - - - - -
        return cnt;
    } // - END i2c_sniffer_v2
    // ----------------------------------------------------

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #6
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/09 11:10:30 (permalink)
    0
    Code Tags off.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #7
    Antipodean
    Super Member
    • Total Posts : 1811
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 17:03:39 (permalink)
    5 (1)
    Thanks Gort, that looks useful.
     
     

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #8
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 19:34:39 (permalink)
    5 (1)
    Thanks.
    It takes longer documenting and formatting to make it look neater for other People to read and understand.
     
    All my code is the same style.
     
    That is how it appears in MPLab X except that I have a black background and is also why I removed the code tags.
     
    Do we even need code tags because the colors it uses are not very good.  I prefer plain text and a color change for comments.

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #9
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 19:40:17 (permalink)
    0
    If using a chip with only one I2C module then replace:
     
    #define     I2C_sizeof  (( I2C2CONL - I2C1CONL ) >> 1 )
     
    With:
     
    #define     I2C_sizeof  (( I2C1CONL - I2C1CONL ) >> 1 )
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #10
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 19:51:40 (permalink)
    0
    There are 3 bugs in the code:
     
    1. The extra line in "#define BUSY".
    2. There is a black 'T' when it should be blue.
    3. Can't remember the other, I'm not going to edit it, takes ages when the forum software decides adds extra blank lines.
     
    I am aware they are there.  OCD, everrything has to be in the right place, lucky I don't need to wash my hands 50 times a Day or walk over cracks.
     
    Anyone else ?
     
     

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #11
    Antipodean
    Super Member
    • Total Posts : 1811
    • Reward points : 0
    • Joined: 2008/12/09 10:19:08
    • Location: Didcot, United Kingdom
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 19:56:51 (permalink)
    0
    Gort2015
    There are 3 bugs in the code:
     
    1. The extra line in "#define BUSY".
    2. There is a black 'T' when it should be blue.
    3. Can't remember the other, I'm not going to edit it, takes ages when the forum software decides adds extra blank lines.
     
    I am aware they are there.  OCD, everrything has to be in the right place, lucky I don't need to wash my hands 50 times a Day or walk over cracks.
     
    Anyone else ?
     

     
    Ah, OK. Maybe keep the hand washing up to avoid COVID-19 ... LoL: LoL

    Do not use my alias in your message body when replying, your message will disappear ...

    Alan
    #12
    Gort2015
    Klaatu Barada Nikto
    • Total Posts : 3835
    • Reward points : 0
    • Joined: 2015/04/30 10:49:57
    • Location: 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/10 20:16:20 (permalink)
    3 (2)
    I'm not a constant hand washer, I look down on them.
     
    On a Sea side Town, the grap arcade machines are now full of toilet rolls.
     
    I'm prepared to self quarantine, Doctors are saying that we may have to stay in.
     
    You can't blame China, they are doing their best.  They built those Hospital fast.
    It would be a better World if they got rid of Communism and joined everybody else.
     
    Iran, N. Korea -  epitome of evil.
     
    Don't really want to discuss Politics, I want to discuss what we like.
    post edited by Gort2015 - 2020/03/10 20:18:20

    MPLab X playing up, bug in your code? Nevermind, Star Trek:Discovery will be with us soon.
    https://www.youtube.com/watch?v=Iu1qa8N2ID0
    + ST:Continues, "What Ships are Made for", Q's back.
    #13
    RISC
    Super Member
    • Total Posts : 5392
    • Reward points : 0
    • Status: offline
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/25 12:00:56 (permalink)
    5 (1)
    Hi Gort2015,
    For which CPU is your code written and which Fclock ?
    Regards
    #14
    ric
    Super Member
    • Total Posts : 26159
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: I2C BUS SNOOPER (Inter - Integrated Circuit) 2020/03/25 12:40:58 (permalink)
    5 (1)
    Gort2015 has left the building...
    https://www.microchip.com/forums/m1132356.aspx
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #15
    Jump to:
    © 2020 APG vNext Commercial Version 4.5