Go to Post Ha, our 2009 robot's nickname was Sparky, for the same reason...we now have EXTRA fire extinguishers because of it ;P - Karibou [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 Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 21-01-2013, 09:17
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 512
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Accelerometer ADXL345 Labview Example Code Not Working.

As title suggests.

As a learning step, we were working through some of the sensor examples with the freshmen to get used to Labview and how sensors return data.

We worked through the encoder, encoder with motor, and the gyro examples, and then wired up the ADXL345 Accelerometer in SPI mode (What does SPI mean?) and we could not get it work.

We would hit the run on labview main panel, the checkerboard would go away, indicating it was running, but no data was being returned to the front panel. Bringing up the block diagram, and trying to probe any data wire, showed it was "Not executed" This was the same for the data prior to the loop, or in the loop, the whole diagram was not executed.

Turning on the light bulb showed nothing of interest either.

So if you have any idea, what I am doing wrong, let me know.
Or if you have done this example in the 2012 labview and it worked, please let me know that too, as that would confirm it was on my end.

Scott. (Mentor)
__________________
The sooner we get behind schedule, the more time we have to catch up.

Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2013, 11:16
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Accelerometer ADXL345 Labview Example Code Not Working.

Quote:
Originally Posted by tr6scott View Post
As title suggests.

As a learning step, we were working through some of the sensor examples with the freshmen to get used to Labview and how sensors return data.

We worked through the encoder, encoder with motor, and the gyro examples, and then wired up the ADXL345 Accelerometer in SPI mode (What does SPI mean?) and we could not get it work.

We would hit the run on labview main panel, the checkerboard would go away, indicating it was running, but no data was being returned to the front panel. Bringing up the block diagram, and trying to probe any data wire, showed it was "Not executed" This was the same for the data prior to the loop, or in the loop, the whole diagram was not executed.

Turning on the light bulb showed nothing of interest either.

So if you have any idea, what I am doing wrong, let me know.
Or if you have done this example in the 2012 labview and it worked, please let me know that too, as that would confirm it was on my end.

Scott. (Mentor)
SPI means Serial Peripheral Interface.

SPI is a digital communication standard that involves 4 interfacing wires:
  1. CK (SCLK) - Serial Clock, a clock signal that controls timing of signals in the device
  2. DI (MISO) - Master In, Slave Out, or in our case, Data In
  3. DO (MOSI) - Master Out, Slave In, or in our case, Data Out
  4. CS - Chip Select, or often called slave select (SS), selects the chip for communication, this signal has inverted logic, meaning you pull the device to logic low to select the chip as active.

Of course, that's not all... For the ADXL345, you also have 2 power wires:
  1. 0V - Ground (-)
  2. 5V - Power (PWR), which is 5 Volts

Here is a link to the AndyMark wiring diagram for the Gyro and Accelerometer board, which shows you exactly how to connect the sensor to the Digital Side Car.

Here is a link to the AndyMark Product Specifications for the Gyro and Accelerometer board.

Here is a link to the ADXL345 Datasheet from Analog Devices.

On to LabVIEW...

Before executing the code, press the Highlight Execution button, and follow where the code stops. It is important to keep the block diagram open so it records what executes and what doesn't execute. If it's not open, it doesn't show you the history.

Let us know what you find.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote
  #3   Spotlight this post!  
Unread 21-01-2013, 19:03
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Accelerometer ADXL345 Labview Example Code Not Working.

When using the ADXL345 in previous years, I chose I2C instead of SPI because it uses fewer wires. I don't remember ever trying SPI, so I can't personally confirm that it works.

The "not executed" indication on a probe just means that it hasn't been executed since the probe was attached. If you run the VI and then put a probe on a wire, you'll never see any values for things that only produce an output once at startup. So nothing outside the loop will have a value unless you place the probe before running the VI.

If you somehow managed to stop the VI when you opened the block diagram, you won't see any values either. Can you confirm that the "run" arrow at the top of the diagram is in the "running" state (solid black)?
Reply With Quote
  #4   Spotlight this post!  
Unread 23-01-2013, 13:03
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,563
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Accelerometer ADXL345 Labview Example Code Not Working.

Here's another person who is having trouble with SPI in LabVIEW. https://decibel.ni.com/content/message/46374#46374
Reply With Quote
  #5   Spotlight this post!  
Unread 24-01-2013, 15:14
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 512
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Accelerometer ADXL345 Labview Example Code Not Working.

Ryan,

Thanks for the links, a little better documentation, but it all matches the front panel of the example, and the way we wired it.

Alan and Joe, thanks for the response.

We have moved on to more pressing items, like bang-bang motor control vs. take-back-half for our shooter rpm control.

I will try and get back to this once we are looking for something to do, but at the moment, we are working on stuff we actually going to use on the bot this year. Being that we are not a climber, hopefully we don't have to know how many G's we pull when we fall 7' and bounce off the floor.

I will update as we get back to it. Thanks.

Scott.
__________________
The sooner we get behind schedule, the more time we have to catch up.

Reply With Quote
  #6   Spotlight this post!  
Unread 24-01-2013, 15:59
Fifthparallel Fifthparallel is offline
Registered User
AKA: Sam Chen
FRC #1410
 
Join Date: Dec 2012
Rookie Year: 2011
Location: Denver, CO
Posts: 65
Fifthparallel is an unknown quantity at this point
Re: Accelerometer ADXL345 Labview Example Code Not Working.

First, here is the sensor manual from 2011. We found it sortof helpful in first learning how to use the sensor.

Some notes:

For SPI, there's a hazy memory about not having the right DIO selected for a specific input from the SPI interface on the accelerometer, refer to the sensor manual or the datasheet for the ADXL345 to learn about what the various acronyms on the board are actually for (and thus know you have the right DIO selected in the LV example.)
  • I2C has been the most hasslefree for us
  • the code in the WPILib for the I2C ADXL345 expects a default hardware address, find out what that is. (For example, with I2C, we had plugged the 4 wires into the wrong I2C ports, and just moved it to the other ones. Hey presto, it worked.)
__________________
sudo chmod u+x helloworld.sh
gotta start somewhere.
Reply With Quote
  #7   Spotlight this post!  
Unread 24-01-2013, 17:03
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: Accelerometer ADXL345 Labview Example Code Not Working.

See the NI forums for the solution.

-Joe
Reply With Quote
  #8   Spotlight this post!  
Unread 24-01-2013, 17:21
tr6scott's Avatar
tr6scott tr6scott is offline
Um, I smell Motor!
AKA: Scott McBride
FRC #2137 (TORC)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2005
Location: Oxford, MI
Posts: 512
tr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond reputetr6scott has a reputation beyond repute
Re: Accelerometer ADXL345 Labview Example Code Not Working.

From NI site for those that may search here:

Re: Issues with the SPI modules.
Hi Phil,

I found the issue. The wrong module is getting selected when opening SPI. We will include the fix in the next update.

In the mean time, all you need to do to fix it is to edit the WPI_SPIOpen.vi to remove the four "-1" VIs that are subtracting the module number.

Cheers,
-Joe
__________________
The sooner we get behind schedule, the more time we have to catch up.

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:51.

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