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
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
I ended up just using an external hardware tool to do the I2C bus scanning.
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.
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.
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.
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
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.
twihs_probe works great, this function wraps a call to twihs_master_write. I found an issue with twihs_master_write, that under some circumstances it can become stuck in a while(1) loop. I had the problem with a slave device that was powered off and so the function never got a NACK or a TXRDY.
Hi
I am new to SAME70Q21 Controller. I just need a support for I2C with ASF's API.I am try to read data from RTC Module DS1307 and its Device address is 0xD0 but my ASF's I2C API is not working I am struct with
/* Wait for a byte has been received in TWIHS_RHR since last read */
while (!hri_twihs_get_SR_RXRDY_bit(dev->hw))
please support to read the data from module...
Hello
I would like to integrate this scan function (from ASF) into my program:
uint32_t twi_probe | ( | Twi * | p_twi, |
uint8_t | uc_slave_addr | ||
) |
"Test if a chip answers a given I2C address.
Parameter
p_twi Pointer to a TWI instance.
uc_slave_addr Address of the remote chip to search for.
Returns
TWI_SUCCESS if a chip was found, error code otherwise."
But I don't know what a TWI instance is or how to create it?
Please help me!
Regards
Wolfgang