I2C scanner for SAM E70

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Hello,

I am looking for a utility to scan all the addresses on the I2C bus on a SAM E70. I seem to find AVR code, but I am not  too familiar with porting and conversion.

Thanks,

Frank

This topic has a solution.
Last Edited: Tue. Nov 14, 2017 - 03:29 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I ended up just using an external hardware tool to do the I2C bus scanning.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

You can do this by slightly modifying the TWI example code for SAME70.
Even though am no expert in atmel studio, but this is something that i have done.

You may tweak the code to ping in every address & see if you get an acknowledgement to any.

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Else if you are looking to listen to IIC chatter thats happening in the bus, you better create a program with ext int & timer modules to decode everything thats happening in those lines.

Silly beans are always silly
:)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe using ASF3, I could check the  status return of  twihs_master_write() to all the values in packet.chip   and put a packet.buffer = 0.  

 

 

 

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why not use:

 

/**
 * \brief Test if a chip answers a given I2C address.
 *
 * \param p_twihs Pointer to a TWIHS instance.
 * \param uc_slave_addr Address of the remote chip to search for.
 *
 * \return TWIHS_SUCCESS if a chip was found, error code otherwise.
 */
uint32_t twihs_probe(Twihs *p_twihs, uint8_t uc_slave_addr)
{

From twihs.c

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for mentioning twihs_probe()

I scanned the whole range with:

void scan_all_device_ids(void){
    uint8_t i;
    puts("Scan all I2C addresses\r\n");
    for (i = 0; i < 128; i++){
        
        if( twihs_probe(BOARD_BASE_TWIHS_EEPROM, i) ==0){
            printf("Found at %#02x  (%#02x) \r\n", i, i*2);
        };
    }; 
    puts("scan done\r\n") ;  
}

 

I include the capture for the 0xAC (not present) and  0xAE (present) for the ATSAME70-XPLD. i2c scan results