Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Help with 2010 Accelerometer & I2C (http://www.chiefdelphi.com/forums/showthread.php?t=80174)

nabioullinr 31-01-2010 12:33

Re: Help with 2010 Accelerometer & I2C
 
For some reason I keep receiving 0.0 from GetAcceleration(); am I instantiating the accelerometer correctly?:
ADXL345_I2C(4, ADXL345::kRange_2G)

(assuming the digital sidecar is connected to slot 4)

nabioullinr 31-01-2010 13:54

Re: Help with 2010 Accelerometer & I2C
 
We attached an oscilloscope to the bus and noticed that the data returned from the slave accelerometer is 0 for all three transactions (x, y, z); could it be attributed to some sort of a power saving feature which is not disabled?

jhersh 31-01-2010 16:23

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by nabioullinr (Post 910630)
We attached an oscilloscope to the bus and noticed that the data returned from the slave accelerometer is 0 for all three transactions (x, y, z); could it be attributed to some sort of a power saving feature which is not disabled?

I'm guessing you didn't fix WPILib... http://www.chiefdelphi.com/forums/sh...5&postcount=12

If you fix the I2C library it should start working for you.

nabioullinr 01-02-2010 15:52

Re: Help with 2010 Accelerometer & I2C
 
How would I patch wpilib? I could not find anything useful (besides the description of the bug).

jhersh 01-02-2010 16:07

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by nabioullinr (Post 911264)
How would I patch wpilib? I could not find anything useful (besides the description of the bug).

Download the source code, change the logical OR to a bitwise OR, build the library, run the Scripts/updateBuiltInLibrary.cmd file to install the compiled library, rebuild your project.

-Joe

Shinigami2057 01-02-2010 16:41

Re: Help with 2010 Accelerometer & I2C
 
Will this patch be in a team update soon? It's not good that teams already have gone this long with broken support for something in the KoP...

jhersh 01-02-2010 16:57

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by Shinigami2057 (Post 911312)
Will this patch be in a team update soon?

I'm not sure... I have no control over release schedules.

Quote:

Originally Posted by Shinigami2057 (Post 911312)
It's not good that teams already have gone this long with broken support for something in the KoP...

I know... that's why I've tried to provide timely workarounds, fixes, problem notifications, feature implementation examples, and support the best I can so that teams will not be held up by the release schedules. It's not ideal to need to patch these things manually, but it's also not good to force every team to install and keep track of 10+ updates in various languages that would all be released independently and out of phase with each other. Many teams can't keep up with the one update released at kickoff.

-Joe

tdidi 01-02-2010 18:21

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by jhersh (Post 911280)
Download the source code, change the logical OR to a bitwise OR, build the library, run the Scripts/updateBuiltInLibrary.cmd file to install the compiled library, rebuild your project.

-Joe

I don't get it. I follow those instructions exactly, and it removes the WPILib from Windriver completely when I run the updateBuiltInLibrary.cmd.

I get the "no such file or directory" error.

jhersh 01-02-2010 18:33

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by tdidi (Post 911388)
I don't get it. I follow those instructions exactly, and it removes the WPILib from Windriver completely when I run the updateBuiltInLibrary.cmd.

I get the "no such file or directory" error.

That probably means you didn't build the library successfully. Make sure you build the debug version, since that's what the script copies.

What file or directory exactly does it fail on?

-Joe

tdidi 01-02-2010 18:48

Re: Help with 2010 Accelerometer & I2C
 
ok, I made a new project in Windriver. I copied the entire WPILib and its files (most recent release) into that project, and made the change to the logical OR.

The build target is specified as "Windows-gnu-native-3.x-4.x-debug" (I'm assuming thats what you mean by building the debug version.)

The error is that it can't find "WPILib.h" after I run the updateBuiltInLibrary.cmd

jhersh 01-02-2010 18:52

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by tdidi (Post 911420)
ok, I made a new project in Windriver. I copied the entire WPILib and its files (most recent release) into that project...

The script is expecting the library source to be in "c:\WindRiver\workspace\WPILib" and if it's not there you will get this behavior.

tdidi 01-02-2010 18:59

Re: Help with 2010 Accelerometer & I2C
 
Thank you sir. You have been most helpful!

Shinigami2057 02-02-2010 00:59

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by jhersh (Post 911331)
I'm not sure... I have no control over release schedules.



I know... that's why I've tried to provide timely workarounds, fixes, problem notifications, feature implementation examples, and support the best I can so that teams will not be held up by the release schedules. It's not ideal to need to patch these things manually, but it's also not good to force every team to install and keep track of 10+ updates in various languages that would all be released independently and out of phase with each other. Many teams can't keep up with the one update released at kickoff.

-Joe

That's quite understandable. Maybe in future seasons it'd be a good idea to do something along the lines of providing weekly updates that merge in the most critical patches for each language; updates that are helpful but not necessary would be included at longer intervals, perhaps only once per season.

The updates could be optional (e.g., not an 'official mandatory' team update) until the season draws to a close to prevent teams freaking out over things that aren't affecting them until ship draws close.

In any case, thanks a lot for your replies and the hard work you've been doing to make the lives of FIRST teams easier :)

tdidi 03-02-2010 19:34

Re: Help with 2010 Accelerometer & I2C
 
Should the cRIO need to be re-imaged for the patched WPILib to take effect?

I find that I am still unable to write to the device.

Extra details:

I know I'm not writing to the device because after I write to PowerControl and DataFormat regAddress's, I read them, and get back nothing (0). I know I'm reading correctly because I can get the DeviceID just fine. I have patched the WPILib as previous posts have instructed, but I think there might be a missing last step or something obvious that I'm missing.

jhersh 04-02-2010 02:22

Re: Help with 2010 Accelerometer & I2C
 
Quote:

Originally Posted by tdidi (Post 912832)
Should the cRIO need to be re-imaged for the patched WPILib to take effect?

I find that I am still unable to write to the device.

Extra details:

I know I'm not writing to the device because after I write to PowerControl and DataFormat regAddress's, I read them, and get back nothing (0). I know I'm reading correctly because I can get the DeviceID just fine. I have patched the WPILib as previous posts have instructed, but I think there might be a missing last step or something obvious that I'm missing.

The cRIO does not need to be reimaged for the WPILib patch to take effect. WPILib is a static lib that is linked with your program and deployed with your application. If I were you I would double check that you are successfully building the library, running the script to install it, and relinking your application. Do something that would prove all these steps are working such as putting a printf inside one of the I2C methods you are changing. If it prints, you know you have linked against the new version of the library.

-Joe


All times are GMT -5. The time now is 12:38.

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