Go to Post We were trying to show that publishing designs increased the quality of every team and was especially helpful to new teams. - N7UJJ [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-01-2012, 22:13
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
not able to read from accelerometer

My team has been having some trouble with the ADXL345 accelerometer. When we try to read from it, the loop within the spi read vi falls into an infinite loop. We have downloaded the updated ADXL 345 SPI vi's, and we tried it with i2c with the same results. We also know that it is not a problem with the accelerometer, because the problem exists with a second accelerometer.

does anyone think of any reason why this would happen, or what we could do to correct it?
Reply With Quote
  #2   Spotlight this post!  
Unread 23-01-2012, 22:23
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: not able to read from accelerometer

A good place to start is the examples that you're given. You already have functional code for both ways to read that sensor. Go under Help->Find Examples and then go under FRC Robotics->Sensors. You'll find example code for reading the ADXL345 with both I2C and SPI interfaces.

I'd also suggest that you double check your wiring and make sure everything's connected correctly (IIRC, the front panel diagrams to the examples also have some wiring drawings to check against).
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #3   Spotlight this post!  
Unread 23-01-2012, 22:42
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
Re: not able to read from accelerometer

I just tried deploying the example code on the CRIO, and the wiring is the same as the wiring diagram, it's still getting stuck inside an infinite loop.

What could possibly be the problem, as this is not specific to this accelorometer, I am not sure what mistake I could possibly be making...
Reply With Quote
  #4   Spotlight this post!  
Unread 24-01-2012, 06:52
rai337 rai337 is offline
Registered User
FRC #1574 (Miscar1574)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2012
Location: israel
Posts: 26
rai337 is an unknown quantity at this point
Re: not able to read from accelerometer

we are having the same problem, the infinite loop, and we are lost too...
Reply With Quote
  #5   Spotlight this post!  
Unread 24-01-2012, 13:27
plnyyanks's Avatar
plnyyanks plnyyanks is offline
Data wins arguments.
AKA: Phil Lopreiato
FRC #1124 (The ÜberBots), FRC #2900 (The Mighty Penguins)
Team Role: College Student
 
Join Date: Apr 2010
Rookie Year: 2010
Location: NYC/Washington, DC
Posts: 1,114
plnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond reputeplnyyanks has a reputation beyond repute
Re: not able to read from accelerometer

The example code is supposed to be an infinite loop. It's an example to show you how to read the accelerometer in code. If the front panel controls are showing you correct values, then everything's working fine. You can then use that code as a springboard to write your own code for your robot project. Remember that the examples are just that: examples.
__________________
Phil Lopreiato - "It's a hardware problem"
Team 1124 (2010 - 2013), Team 1418 (2014), Team 2900 (2016)
FRC Notebook The Blue Alliance for Android
Reply With Quote
  #6   Spotlight this post!  
Unread 24-01-2012, 22:29
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
Re: not able to read from accelerometer

Quote:
Originally Posted by plnyyanks View Post
The example code is supposed to be an infinite loop. It's an example to show you how to read the accelerometer in code. If the front panel controls are showing you correct values, then everything's working fine. You can then use that code as a springboard to write your own code for your robot project. Remember that the examples are just that: examples.
I understand that, but the problem is that it's not getting any data. The infinite loop is in the "read spi" vi, and the problem is that it's not reading anything. screen cap attached of the problem area attached.

in the picture, the problem is that that while loop isn't ending.
Attached Thumbnails
Click image for larger version

Name:	problemScreencap.png
Views:	46
Size:	140.3 KB
ID:	11559  
Reply With Quote
  #7   Spotlight this post!  
Unread 25-01-2012, 00:10
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
Re: not able to read from accelerometer

Update: Not sure what we did, but we're no longer getting stuck in that loop. Unfortunatly, while we're getting data back, that data is consistently zero. Is it reading from the correct register? or do we need to set that ourself?
Reply With Quote
  #8   Spotlight this post!  
Unread 25-01-2012, 22:14
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
Re: not able to read from accelerometer

So does anyone know what you need to change in the example in order for it to work? I checked my ports, and they're all correct, but I'm only getting data of zero...
Reply With Quote
  #9   Spotlight this post!  
Unread 26-01-2012, 10:56
mswalker mswalker is offline
Mentor
FRC #2583 (Westwood Robotics)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 26
mswalker is on a distinguished road
Re: not able to read from accelerometer

One thing we found was that the accelerometer example read loop was set to stop if read status showed an error (in the I2C code.) By removing that stop condition we were able to get readings even though there was an occasional read error. Adding a graph indicator allowed us to see the values read over time.
Reply With Quote
  #10   Spotlight this post!  
Unread 26-01-2012, 20:37
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,372
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: not able to read from accelerometer

Just to save some time, I've done the latest Utilities update, used both round and flat cable, triple checked my wiring. We are using I2C.
When I have the right digital module (1) selected, I get "0" as the reading. Bypassing the stop from "status" I can read the error.
-44095 It is anticipating address 58 but received ... "Sensor did not respond".
When selecting the wrong module (2), I just get no errors and "0" as a reading.

Any ideas?
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #11   Spotlight this post!  
Unread 26-01-2012, 21:00
NeatNit's Avatar
NeatNit NeatNit is offline
Alumni Programmer
FRC #1577 (Steampunk)
Team Role: Teacher
 
Join Date: Sep 2011
Rookie Year: 2011
Location: Israel
Posts: 60
NeatNit is an unknown quantity at this point
Re: not able to read from accelerometer

I had the same problems, and the only thing that worked for me was to use the flat cable and use I2C. I couldn't get SPI to work no matter what (in fact, I can't figure out for the life of me how the SPI VIs are supposed to work, they're arranged in a very strange way). Even the supposedly fixed example didn't work, and I even noticed the problem and tried to fix it before the fix was posted.

Anyway, use a flat cable, and use I2C. Make sure your cable is fixed according to these instructions: http://www.usfirst.org/sites/default...structions.pdf
Reply With Quote
  #12   Spotlight this post!  
Unread 27-01-2012, 16:09
joe5joe7's Avatar
joe5joe7 joe5joe7 is offline
Head of Programming
AKA: Joseph Kaiser
FRC #2928 (Viking Robotics)
Team Role: Programmer
 
Join Date: Dec 2011
Rookie Year: 2009
Location: Seattle
Posts: 27
joe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nicejoe5joe7 is just really nice
Re: not able to read from accelerometer

Well I got an accelerometer working, but not the ADXL 345. The electrical head on my team found an ADXL 335 in the drawers, and we just wired that up to the analog and read the voltage.

I'm not sure if this is an option for other teams, but it's working fine for us now. I hope you guys figure out why the 345 isn't working though...
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 22:31.

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