From: p.g.adamczyk <p.g...@gm...> - 2009-10-28 18:11:34
|
Thanks, Dave, Alas, I have already disabled lots of stuff, and I have begun wondering whether it might be some sort of conflict in the definitions somewhere in the header files (?). The PinPulse ISR is as simple as you suggest, and should be no problem: pin_hi, nop, pin_low, return I know that does not cause problems on its own, because it works in my "enhanced" i2c-io program (with multiple ADCs in one return). I have disabled many sets of things. Here are the symptoms: Disable Timer2 (and thus prevent any PinPulse interrupt): manual i2c-io calls return the same errors Disable PWM outputs, and all the background definitions for them in the early part of the file: automatic (@100Hz) and manual calls to i2c-io functions all fail (same errors) Disable a2d_10 calls in the controller code: same errors *note that I have not commented out the header a2d.h - I will try this later Disable array storage and update in the controller code: same errors * Disable everything in my controller code, as well as the Timer2 interrupts and PWM outputs (Which should have returned the code to the same state as the original working "enhanced" i2c-io): same errors! Writing this, I feel like there may be an finger pointing at some conflict between the headers (??) needed/used for Simple-Servo and i2c-io. Perhaps the "a2d.h" file, which I realize I did not comment out during my tests. I will try commenting out the "a2d.h" header file and the analog sampling later, and see what happens. Are there any other definition conflicts or register conflicts you can think of between these two pieces of code? Thanks very much, -Peter Dave Hylands wrote: > > Hi Peter, > > On Wed, Oct 28, 2009 at 9:09 AM, p.g.adamczyk <p.g...@gm...> > wrote: >> >> Hi, List, >> >> Using a Verdex XM4BT and a Robostix, I have long had the i2c-io code (by >> Dave Hylands) working, with some modifications for time-regular data >> logging >> to the gumstix (~100 hz). > > ...snip... > >> // Peter's code to signal Port.E2 >> >> //Tell the board to produce a pulse when Timer 2 overflows >> >> ISR( TIMER2_OVF_vect ) //This sets the "Interrupt Service Routine" that >> happens when Timer2 Overflows >> >> { >> >> PinPulse_Issue( GumInt ); //The routine is "PinPulse," which >> rapidly puts >> the pin high and then low. >> TCNT2 = TCNT2RESET; // Reset the TCNT2 >> Register to a non-zero value to >> fine-tune the frequency. This value can be between 0 and 255. The >> Frequency >> achieved will depend on the Prescaler as well. For prescaler = 256 and >> TCNT2 >> reset value = 130, we should interrupt at exactly 500 Hz. It works pretty >> well, though 500hz appears to be too fast for 8 channels even in fast >> mode >> of i2c. >> >> //GumInt is a string that will be >> prepended to a bunch of variable names >> to make the functions happen >> >> } > > So, I see that there is a call to PinPulse_Issue from inside an ISR > handler. > > Note that interrupts are disabled while processing an interrupt > handler, and as a general rule ISR handlers shouldn't contain any > significant delays. If the code is just setting the pin high and then > low with perhaps a few instructions between, then you should be fine. > Otherwise, if the delay is significant (like anything over tens of > microseconds), then this could be messing with the i2c interrupts. At > 100 kHz, the i2c interrupts occur roughly once every 100 microseconds > (during a transfer). > > Try disabling portions of your code to see if that makes the i2c stuff > start working again. > > -- > Dave Hylands > Shuswap, BC, Canada > http://www.DaveHylands.com/ > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry(R) Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9 - 12, 2009. Register now! > http://p.sf.net/sfu/devconference > _______________________________________________ > gumstix-users mailing list > gum...@li... > https://lists.sourceforge.net/lists/listinfo/gumstix-users > > -- View this message in context: http://www.nabble.com/Verdex-%2B-Robostix---Combining-I2C-with-a-Controller--tp26097482p26099415.html Sent from the Gumstix mailing list archive at Nabble.com. |