SAMR21 i2c (slave) I2C_QUICK_START_SLAVE_BASIC_USE1 with raspberrypi always show slave address as 28 where as SLAVE_ADDRESS 0x12 is configured in program

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

did flash SAMR21 xplained board with the ASF sample project I2C_QUICK_START_SLAVE_BASIC_USE1. Slave address configured is 12. Connected this xplained board to raspberry pi i2c pins. So far so good. Now when i issue

i2cdetect, slave address is shown to be 28 where as address in program is only 12.

pi@cutiepie ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:               -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         

 

Every time when i disconnect the SAMR21 from raspberrypi ,  i2cdetect -y 1 does not detect slave address 28. Strangely this slave address is not present when edbg usb is disconnected, which makes me believe that address 28 on i2c bus is some how related to edbg. Would like to have your suggestion on how to proceed with debugging the issue. I would like to have #define SLAVE_ADDRESS 0x12 on i2cbus.

 

 

 

This topic has a solution.

Last Edited: Tue. Aug 4, 2015 - 06:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ramya wrote:
SAMR21 xplained board ... slave address is not present when edbg usb is disconnected, which makes me believe that address 28 on i2c bus is some how related to edbg.

Both the User Guide and Schematic will show you that one of the SAM R21's I2Cs is connected to the EDBG - is that the one you're using?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No. My requirement is not to communicate with edbg but to deliver data to  program with SLAVE_ADDRESS 0x12 running in samr21  (data from i2c user space->i2c_bcm2708 kernel space->i2cbus->samr21 slave ASF sample). For this I have flashed with ASF sample project for SLAVE_ADDRESS 0x12 into SAMR21. This particular SLAVE_ADDRESS 0x12 is not detected on the i2c bus with Raspberry pi. Really appreciate if you can throw some hints to resolve this.

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

You missed my point:

 

One of the SAM R21's I2C ports is physically connected to the EDBG - are you connecting to that same I2C port?

 

Really appreciate if you can throw some hints to resolve this.

My hint is: do not use the same I2C pins that are also connected to the EDBG; ie, use a completely different I2C port - so that there's no risk whatsoever of any possible interference from anything else (in particular, the EDBG).

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Will this thread win the prize for the longest title EVER? surprise

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Hasn't that already been awarded to someone who put their entire post into the title ?!

 

surprise

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

You missed my point:

 

One of the SAM R21's I2C ports is physically connected to the EDBG - are you connecting to that same I2C port?

Okay got it. I hav run few test and can confirm that address 28  seen on i2c bus is for EDBG.

#define EDBG_I2C_MODULE              SERCOM1
#define EDBG_I2C_SERCOM_PINMUX_PAD0  PINMUX_PA16C_SERCOM1_PAD0
#define EDBG_I2C_SERCOM_PINMUX_PAD1  PINMUX_PA17C_SERCOM1_PAD1
#define EDBG_I2C_SERCOM_DMAC_ID_TX   SERCOM1_DMAC_ID_TX
#define EDBG_I2C_SERCOM_DMAC_ID_RX   SERCOM1_DMAC_ID_RX

awneil wrote:

My hint is: do not use the same I2C pins that are also connected to the EDBG; ie, use a completely different I2C port - so that there's no risk whatsoever of any possible interference from anything else (in particular, the EDBG).

#define EXT3_PIN_11               PIN_PA16
#define EXT3_PIN_12               PIN_PA17

#define EXT3_PIN_I2C_SDA          EXT3_PIN_11
#define EXT3_PIN_I2C_SCL          EXT3_PIN_12

#define EXT1_PIN_11               PIN_PA16
#define EXT1_PIN_12               PIN_PA17

#define EXT1_PIN_I2C_SDA          EXT1_PIN_11
#define EXT1_PIN_I2C_SCL          EXT1_PIN_12

 

Used pins PIN_PA16&PIN_PA17 for i2c in samr21 as before in both EXT3 and EXT1, but could not detect slave address. The problem seems to be with SERCOMx selection. Default sample program in ASF uses i2c_slave_init(&i2c_slave_instance, SERCOM2, &config_i2c_slave); when changed to sercom 3 the slave is detected on i2c bus.

Thanks awneil, I could now proceed playing with i2c.

pi@cutiepie ~ $ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- 12 -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- 28 -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --                         

 

Last Edited: Tue. Aug 4, 2015 - 07:26 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

enlightened... Forgive me. I usually rely on forum site to restrict my title length. I realized now that this is pretty long title..laugh