Go to Post Search is amazing. Give it a try. It's 10,000 lines of code that gets lonely if it's not played with often. - Brandon Martus [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-02-2011, 17:20
brian3795 brian3795 is offline
Registered User
FRC #3795
 
Join Date: Jan 2011
Location: Garland, TX
Posts: 29
brian3795 can only hope to improve
Re: ADXL345 I2C Accelerometer NOT WORKING

Well, we ended up getting it to work in SPI mode (we did have to shorten the loop time from 100ms to 10ms). So we'll just live with that unless we run out of DIO ports. Thanks!
Reply With Quote
  #2   Spotlight this post!  
Unread 03-03-2011, 19:13
Trevin Trevin is offline
Registered User
FRC #3191
 
Join Date: Mar 2011
Location: US
Posts: 1
Trevin is an unknown quantity at this point
Re: ADXL345 I2C Accelerometer NOT WORKING

I have been trying to hook up my accelerometer and have had similar problems. I am writing in Java and have tried using the ADXL345_I2C class to interface with the accelerometer, but to no end. Every time I try to get the acceleration all I get back is 0, no matter how much I shake it.

I have also tried using I2C directly and still got nothing.

I would like to try SPI, but I don't know how I would get the data back in the code, the DigitalInput class only returns boolean values, not doubles.

If someone could tell me how to use SPI in Java or what I'm doing wrong with the I2C I would really appreciate it!!! Thanks.
Reply With Quote
  #3   Spotlight this post!  
Unread 04-03-2011, 00:48
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Exclamation Re: ADXL345 I2C Accelerometer NOT WORKING

Quote:
Originally Posted by Trevin View Post
I have been trying to hook up my accelerometer and have had similar problems. I am writing in Java and have tried using the ADXL345_I2C class to interface with the accelerometer, but to no end. Every time I try to get the acceleration all I get back is 0, no matter how much I shake it.

I have also tried using I2C directly and still got nothing.

I would like to try SPI, but I don't know how I would get the data back in the code, the DigitalInput class only returns boolean values, not doubles.

If someone could tell me how to use SPI in Java or what I'm doing wrong with the I2C I would really appreciate it!!! Thanks.
There is not currently an easy-to-use API in java for accessing SPI so I recommend against that (unless you are savvy C++ to Java porters and would like to contribute an implementation). I2C should work (works on the sensor I have) but check for errors on the console.

Joe
Reply With Quote
  #4   Spotlight this post!  
Unread 05-02-2012, 20:18
Bob649 Bob649 is offline
Technical Mentor
FRC #0649 (Fish)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Saratoga HS
Posts: 7
Bob649 is an unknown quantity at this point
Re: ADXL345 I2C Accelerometer NOT WORKING

(Bump on an old thread and hope someone sees it!)

Hello all,
I am having the same problem. We are using Java. Can someone post the wiring diagram from LabView or a screenshot of it? I can not find one though I looked. I did put a scope on the clock and data and they show traffic, but I don't have a protocol analyzer to tell if the traffic is correct.
Also can anyone who has it working confirm if we need to put out own pullup resistor on the CS pin to get into i2c mode? It doesn't look like it, but it could just be the cRIO telling the senor to wake up over and over again.
The code seems so simple I can't imagine it is the code, but if anyone knows any non-obvious points, that would also be appreciated.
Thank you in advance!

Bob
PS My first CD post!
Reply With Quote
  #5   Spotlight this post!  
Unread 05-02-2012, 20:58
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: ADXL345 I2C Accelerometer NOT WORKING

We have it working. We did nothing but solder the pins to the board and wire the 4wires to the digital sidecar. The LabVIEW example shows how.

Joe
Reply With Quote
  #6   Spotlight this post!  
Unread 06-02-2012, 02:47
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: ADXL345 I2C Accelerometer NOT WORKING

We are having the same issue.

Tried multiple DB-37 cables - round, ribbon, several different connectors, etc.
Tried multiple 4-pin I2C cables.
Tried 2 different ADXL345 board.
Tried both a 4-slot and 8-slot cRIO.
Checked that the pull-up resistors in the DSC are working - we see about 3k between 5V and SDA, 5V and SCL.
SDA and SCL see about 4.6V.

We don't have a scope to check waveforms unfortunately.

We are programming in Java, and all we get back are 0.0 for all three axes.

There are no errors thrown.

I would love to get this working, but we opted to use a 2nd analog gyro turned sideways instead.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #7   Spotlight this post!  
Unread 06-02-2012, 11:17
Bob649 Bob649 is offline
Technical Mentor
FRC #0649 (Fish)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Saratoga HS
Posts: 7
Bob649 is an unknown quantity at this point
Re: ADXL345 I2C Accelerometer NOT WORKING

Hello all,
I am beginning to wonder if the issue is the specific combination we are using. Does anyone out there have it running with this combination:
* Java
* 8 slot cRIO

So far I have seen LabView and 4 slot examples running, but nothing confirmed with Java and 8 Slot. I wonder if there is a bug somewhere in the library support?

Does anyone have _any_ i2c devices working with that combination?

Thanks again!

Bob
Reply With Quote
  #8   Spotlight this post!  
Unread 06-02-2012, 13:51
xisybyl xisybyl is offline
Registered User
FRC #3648
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Denver
Posts: 33
xisybyl is an unknown quantity at this point
Yet another case of ADXL345 I2C Accelerometer NOT WORKING

We ARE using LabVIEW and tried both SPI and I2C examples, having updated the example from Sourceforge as mentioned in another thread. We rang out several round cables (checked good), but don't have a flat cable (it was damaged during repair). (I can't see why that should make a difference). We don't have a scope available.

There seem to be teams for which it works, and teams for which it doesn't. Again, we ARE using LabVIEW and are fully updated. The example gets into the Read VI and appears to stay there waiting for a response. I have no way of knowing whether the accelerometer didn't receive the previous write or it just isn't sending a value to be read.

Can ANYONE help??? National Instruments???
Reply With Quote
  #9   Spotlight this post!  
Unread 06-02-2012, 14:33
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Yet another case of ADXL345 I2C Accelerometer NOT WORKING

If you are stuck in read, that usually means that one of the I2C lines are stuck low. Make sure there are no shorts on your sensor.

Joe
Reply With Quote
  #10   Spotlight this post!  
Unread 06-02-2012, 15:25
xisybyl xisybyl is offline
Registered User
FRC #3648
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Denver
Posts: 33
xisybyl is an unknown quantity at this point
Re: ADXL345 I2C Accelerometer NOT WORKING

We tried more than one.
Reply With Quote
  #11   Spotlight this post!  
Unread 06-02-2012, 18:20
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: ADXL345 I2C Accelerometer NOT WORKING

Quote:
Originally Posted by xisybyl View Post
We tried more than one.
Another way this can happen is if the sensor is not powered. Are all the power supply LEDs lit on the digital sidecar?
Reply With Quote
  #12   Spotlight this post!  
Unread 07-02-2012, 02:55
Bob649 Bob649 is offline
Technical Mentor
FRC #0649 (Fish)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Saratoga HS
Posts: 7
Bob649 is an unknown quantity at this point
Solved - Re: ADXL345 I2C Accelerometer NOT WORKING

Hello all,
I found it - it was multiple faulty cables to the sidecar. The only one that works is a new flat cable from this year that I repaired according to the instructions on the KoP site. It looks like I probably had two problems at the beginning and after I fixed the other one, had the faulty cable issue. Once I got it running, it has been stable.

I will post some photos is anyone is interested in seeing some documentation of an end to end system including some scope shots of traffic.
I guess the "bad" cables must be good enough for the low order PWMs and other channels we were using to fool me.

So the moral of the story, even if you are sure your round cable is good, ONLY use a new flat cable without a twist until you get it working. Then switch other items one at a time so if it stops working you know what it was that went wrong.

Thanks to all who replied!

Bob
Reply With Quote
  #13   Spotlight this post!  
Unread 06-02-2012, 15:35
Phalanx's Avatar
Phalanx Phalanx is offline
Formerly Team 1089 (Mercury)
AKA: Michael Reffler
FRC #5431 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jun 2005
Rookie Year: 1999
Location: Lewisville, TX (previously NJ)
Posts: 384
Phalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond reputePhalanx has a reputation beyond repute
Re: ADXL345 I2C Accelerometer NOT WORKING

I've experienced quite a variety of issues, but let me share what I have done to get it finally working to some degree. This is using the Labview example with I2C interface only.

1) Make sure the cable you use to connect from the CRIO to Digital Side Car is correctly pinned and in proper working order.
a) We found our round molded ones from previous years to be faulty as others have described here.
b) We tried the ribbon cable from last season (from Andymark irrc) which also did not work for us.
c) We repaired this years ribbon cable, which does work.

2) Make sure your connections to the accelerometer as well as to the digital side car are clean and good. It appears from my testing the I2C is very very sensitive to poorly made cables and it will have a large impact on it's ability to communicate.

3) When using the example I2C, I found I had better success when I ran the driver station application on the same laptop as the example. I noticed in the example code an open/close for the driver station so I started running it.

4) Even with all of the above, sometimes it works, sometimes it fails to respond, sometimes it works for a while, then fails. All the failures are a failure to respond.
__________________
Don't just ask the experts, become one!
Leadership is not about ability. It's about responsibility!
Diagonally Parked in a Parallel Universe. It's okay we do Quantum Physics


Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi