Pages: [1]   Go Down
Author Topic: i2c causing board to reset  (Read 1117 times)
0 Members and 1 Guest are viewing this topic.
london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi

I'm trying to get i2c working on an arduino Diecimila.

The board keeps reseting at the point where the code calls Wire.begin

I've stripped out all the code apart from this-

#include <Wire.h>
 

 
void setup()
{
  Serial.begin(9600);
  Serial.println("coming out of reset");
  Wire.begin();
}
 
void loop()
{
 Serial.println("in loop");
 delay(1000);
}


if I comment out the Wire.begin line then the code gets tot the "in loop" print and continues looping, if Wire.begin is in the code then it prints "coming out of resetb" to the serial port (with an extra b in every time) and restarts printing that out every 7 seconds.

Whether the i2c device is connected or not makes no difference, it still behaves the same.

Will try setting it up with another board, but if anyone has any pointers that would be great.

Cheers

Nick

Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I know people have had problems with the wire library in the past.  You might try deleting all the .o files in the lib/targets/libraries/Wire subdirectory of the Arduino application directory (including its subdirectories).

When you comment out Wire.begin() do you leave the #include <Wire.h>?  
Logged

london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes the include is still in.

Will try deleting those and report back.

Cheers

Nick
Logged

london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Deleting the .o files has worked.

It now goes through to the main loop, and has with other sketches too from the forum too.

Thanks for that.

Now to get the i2c communication actually communicating.

Cheers

Nick
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, which version of the Arduino software are you using?
Logged

london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This machine is still on 007 - I will try 008 and see if that works straight out of the box.

Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome, thanks.  I think the problem should be fixed in 0008.
Logged

london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

yep its fine in 008 with no tweaking.

Sorry hadn't realised I hadn't updated the machine I was working on, I would have tried that straight away if i had.
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool, thanks for trying it out.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks!
This was happening to me as well.
I was totally stumped - until i read this post.

Thanks guys,
Mark
Logged

Torino, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino really rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Finally, were you able, both of you, to drive some I2C devices?
I am very interrested in Arduino, but I use I2C quite often for sensors, EEPROMs, devices...
I'd really like to know that I can use it.

Thanks
Logged

london
Offline Offline
Full Member
***
Karma: 0
Posts: 148
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes I got it working fine.
Logged

Torino, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino really rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How could you managed sending some ACK and NotACK "commands" ? Is this automatically done using the Wire Library?
I want to use a MCP9803 temperature sensor.
Logged

Pages: [1]   Go Up
Jump to: