I2C R/W Test. Debug code posted here.

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
Post Reply
flyman777
Posts: 55
Joined: Mon Sep 19, 2011 1:44 pm

Re: I2C R/W Test. Debug code posted here.

Post by flyman777 »

Hi ALEX , Hi ALL,

Thank you for the last release of V1.9.
With the first release 1.9, I had problems with the yaw servo twitching and some randomly flips in roll. So I went back to DEV20011029 which works very well.
Apparently they were problems wuth ic2 transmissions.
I uploaded today the last release and all is working perfectly and my tri flyes as never.

However I made some changes in IMU.pde, I feel the tri is more better flying and the stable mode is so much precise yet. The acro mode is also more precise and agile with my settings.
I fly a Atmega328P UNO on self made board + WM+ + BMA180
Trusted-accz remains commented.

My changes:

in IMU.pde :

#define ACC_LPF_FACTOR 6 //3->8, 4->16, 5->32, 6->64

#define GYR_CMPF_FACTOR 330.0f

in void getEstimatedAttitude(){ :
...
static int32_t accTemp[3];
...
#if defined(ACC_LPF_FACTOR)
accTemp[axis] = (accTemp[axis] - (accTemp[axis] >>ACC_LPF_FACTOR)) + accADC[axis];
accSmooth[axis] = accTemp[axis]>>ACC_LPF_FACTOR;
#define ACC_VALUE accSmooth[axis]
...

Thanks a lot
Regards
Claude
flyman777

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: I2C R/W Test. Debug code posted here.

Post by mr.rc-cam »

I've just re uploaded a new 1.9 ... {snip .. snip}
i2c_errors_count is now int16_t and is used in debug2 variable by default.
again, it's a quick mod, not optimal

Thanks, I'll try out the new version later today. Now if anyone using the latest code still complains of spikes or glitches, the debug value will help ID bad I2C hardware. There will probably be some models that still have intermittent data spike problems, so be sure to spread the news about your new I2C error count feature to help them troubleshoot it.

- Thomas

flyman777
Posts: 55
Joined: Mon Sep 19, 2011 1:44 pm

Re: I2C R/W Test. Debug code posted here.

Post by flyman777 »

Hi,
I made today 8 flights with the last release and NO i2c errors either on LCD or on GUI.
The tri became so precise that I can fly quasi with a precision of 1 cm !

Best regards

flyman777

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: I2C R/W Test. Debug code posted here.

Post by ronco »

Hi,

and great work alex !

i have tested it on three arduino + wmp configs for houres and have zero i2c errors..

so we dont need the pin 12 wmp power reset function anymore?



regards

Felix

Alexinparis
Posts: 1630
Joined: Wed Jan 19, 2011 9:07 pm

Re: I2C R/W Test. Debug code posted here.

Post by Alexinparis »

ronco wrote:Hi,

and great work alex !

i have tested it on three arduino + wmp configs for houres and have zero i2c errors..

so we dont need the pin 12 wmp power reset function anymore?



regards

Felix


Hi,
Yes exactly, this portion of code is now removed as this should not be useful anymore.

spagoziak
Posts: 171
Joined: Thu Jan 20, 2011 1:18 am

Re: I2C R/W Test. Debug code posted here.

Post by spagoziak »

[quote="Alexinparis"]Hi Thomas,

I think I found something very interesting tonight.
[snip]
But if we don't wait for the STOP command acknowledgement , it works very well.
All my bad clones are now usable without any risk to freeze !

And the best: it works also very well with every other I2C sensors. It's maybe the end of bad spikes.
Could you try with this new Sensors.pde
[snip]

Though I haven't had a chance to fly this code yet, I'm very excited--0 errors after 10 minutes! Thank you very much Alex & Thomas :)

spag

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: I2C R/W Test. Debug code posted here.

Post by mr.rc-cam »

Though I haven't had a chance to fly this code yet, I'm very excited--0 errors after 10 minutes!

Please note that Alex's code patch you used does NOT report the I2C errors (if used as-is). So download the latest V1.9 and use it instead.

ashta
Posts: 14
Joined: Mon Mar 14, 2011 9:37 am

Re: I2C R/W Test. Debug code posted here.

Post by ashta »

hello all,

wanted a clarification.
Will the latest code 1.9 support the I2C R/W test and show in debug2 window of the GUI? Or do i have to write the patch as discribed in the begining of this thread?
Some where i read that the debug2 value should be -1 and not zero if it is working.
kindly clarify

best regards
ashta

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: I2C R/W Test. Debug code posted here.

Post by mr.rc-cam »

Will the latest code 1.9 support the I2C R/W test and show in debug2 window of the GUI? Or do i have to write the patch as discribed in the begining of this thread?

Alex's latest V1.9 code (dated Nov-12) has the I2C error counter in the Debug2 window. The earlier V1.9 releases did not have it.

Because there are three releases that were labeled V1.9, some confusion about the I2C test feature has occurred. That is to say, it is possible to have I2C errors with V1.9 that are not reported in Debug2 if you have installed an earlier version of V1.9! So if your V1.9 Debug2 says 0, it may mean you have no errors or it may mean that you have the wrong V1.9 installed.

Some where i read that the debug2 value should be -1 and not zero if it is working.

With the patch implementation discussed here, the Debug2 value shows -1 if the I2C test code is active (and no I2C errors are occurring). However, Alex did not use the "-1" trick so there is no way to know if you have the latest V1.9 that has the I2C error counter feature. If in doubt, download V1.9 from the software storage site again and start over.

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: I2C R/W Test. Debug code posted here.

Post by Hamburger »

Hi,
I have a hanging system with v1.9 when the magneto is activated. Copter works with v1.8p1.
Pullups to sensor board FreeIMUv1 are 2.7k. Concise description here viewtopic.php?f=8&t=941.
Would this error be i2c related? What could I try to diagnose the error further?

mr.rc-cam
Posts: 457
Joined: Wed Jul 27, 2011 11:36 pm

Re: I2C R/W Test. Debug code posted here.

Post by mr.rc-cam »

Hamburger wrote:Hi,
I have a hanging system with v1.9 when the magneto is activated. Copter works with v1.8p1.
Pullups to sensor board FreeIMUv1 are 2.7k. Concise description here viewtopic.php?f=8&t=941.
Would this error be i2c related? What could I try to diagnose the error further?


Your GUI lockup is a sign that you do not have the latest V1.9 installed; The earlier version would freeze the GUI if it encountered any I2C issues, so there is a chance you do not have the correct V1.9 installed. Beyond that, please see my comments in your other discussion.

ashta
Posts: 14
Joined: Mon Mar 14, 2011 9:37 am

Re: I2C R/W Test. Debug code posted here.

Post by ashta »

thanks mr.rc-cam for such clear and crisp reply.

Post Reply