go_away

Author Topic: Axon II and I2C in different pins  (Read 1046 times)

0 Members and 1 Guest are viewing this topic.

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
Axon II and I2C in different pins
« on: March 10, 2011, 10:14:23 AM »

Hi guys,

I have my old Axon II that had a problem with the I2C pins. They don't work and I was wondering if there's a way to use other digital pins as I2C.

any ideas?

thanks

Theo

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,154
  • Helpful? 110
Re: Axon II and I2C in different pins
« Reply #1 on: March 10, 2011, 10:29:57 AM »
Not sure why your I2C pins don't work. The processor on the AxonII only supports one set of hardware I2C pins. But you can simulate I2C in software and use any pins you like. If you are using WebbotLib then this does all the coding for you.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
Re: Axon II and I2C in different pins
« Reply #2 on: March 10, 2011, 10:35:19 AM »

I'm not sure why they don't work, I tested every I2C sensor I have and I get nothing-not even 0s, with the same code I used to work.
I even tested the I2C sensors in another controller and they work fine.

I'm using Webbotlib, how will I simulate I2C in software?

thanks!

Theo

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
Re: Axon II and I2C in different pins
« Reply #3 on: March 10, 2011, 10:42:03 AM »
Using WebbotLib, set those I2C pins as simple digital outputs. Have it pulse every second, and then measure the pulse using a multi-meter.

This will verify pins are connected and working (ie not fried or poor solder joints).

Quote
I even tested the I2C sensors in another controller and they work fine.
Does this other controller also use WebbotLib? (perhaps there is a coding mistake)

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
Re: Axon II and I2C in different pins
« Reply #4 on: March 10, 2011, 10:52:22 AM »
Using WebbotLib, set those I2C pins as simple digital outputs. Have it pulse every second, and then measure the pulse using a multi-meter.

This will verify pins are connected and working (ie not fried or poor solder joints).

Quote
I even tested the I2C sensors in another controller and they work fine.
Does this other controller also use WebbotLib? (perhaps there is a coding mistake)

no, the other micro is a Brainstem and it has its own I2C libraries.

I will do this test and will let you know.

thanks

theo

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,154
  • Helpful? 110
Re: Axon II and I2C in different pins
« Reply #5 on: March 10, 2011, 01:37:22 PM »

I'm using Webbotlib, how will I simulate I2C in software?



In Project Designer add an I2C | I2C Master, change the dropdown from 'Hardware' to 'Software'. This will then prompt you for the pins to use for the bus. Then add the slave I2C devices.
NB You MUST add external pullup resistors for the two lines - as noted in Project Designer
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline teoxanTopic starter

  • Full Member
  • ***
  • Posts: 49
  • Helpful? 2
Re: Axon II and I2C in different pins
« Reply #6 on: March 10, 2011, 03:06:45 PM »

I tested the pins with a multimeter, they are "dead".

I will try with the Project Designer and two other digital pins.

by the way, for those of you using a TPA81, you know that sensor has servo pins on it.

I have written a small function to pan an attached servo on it.

below is the code.

Code: [Select]


//it requires that you declare a TPA81 sensor and initialize it in appInitHardware

void tpa81_pan()
{
 int servo_reg=0; //register address for servo
 uint8_t address=0xD0; //address TPA81

for(int i=0;i<=31;i++)
  {
if(i2cMasterWriteRegister(address,servo_reg,i)) //start servo panning- 0 is minimum position, 31 is maximum
 {
 temperatureRead(tpa);
   rprintf("\nTemperature: ");
rprintf("\n%d", tpa.temperature.celsius);
rprintf("\n%d", tpa.sensor[0]);
    rprintf("\n%d", tpa.sensor[1]);
rprintf("\n%d", tpa.sensor[2]);
rprintf("\n%d", tpa.sensor[3]);
rprintf("\n%d", tpa.sensor[4]);
rprintf("\n%d", tpa.sensor[5]);
rprintf("\n%d", tpa.sensor[6]);
rprintf("\n%d", tpa.sensor[7]);
   
   delay_ms(250);  // change delay for faster or slower panning
   }
 
 else
     {
      rprintf("no i2c communication\n");
     }
   
}

It worked fine with a Hitec HS322 servo on it.

theo

 


Get Your Ad Here