Novice Programmer Questions

I dont want to litter the place with nonsense, but I'm trying to learn and have hit a brick wall.  I took Jean-Louis' tricopter code which runs on IMU V2 and tried many different ways to add IMU V3.  I assembled a PPM encoder, Cut up an old GWS Rx for the pins, made all the connections, modified the code the best I could and it almost works.  The almost part is driving me crazy. 

The problem is when the MPU6000_Init() is added, it stops communicating with the Rx and the ESC's.  If I take that out of the code, the ESC's arm and I have control of throttle and sticks.

I see that Ardupilot 2.7.1 has fast medium and slow loops.  The way this IMU/copter is written it has one loop running at 70 Hz. 

 

The first question seems to be how do I divide up the time?  Will that even solve the problem?

What are the principles behind that?  Do I just follow how Ardupilot did it and hope I get lucky?

 

 

  AutoStab_IMUV32-120728a.zip

 

You need to be a member of diydrones to add comments!

Join diydrones

Email me when people reply –

Replies

  • I think I know what your problem is. The pins labeled MOSI, MISO, and SCK can not be used on the IMU3 as these are pins that the MPU6000 uses for SPI communication. They are only brought out on the board because they are needed to load the boot loader firmware. On the IMU 2 they might have been used for digital lines as no SPI was being used. You can use the analog pins for servo outputs if you generate the pulses with timer interrupts. You don't need to use the PWM modules. I have the IMU3 reading PPM or PWM and outputting PWM or PPM. I use this for a camera stabilizer and now a head tracker. You can download my gimbal stabilizer here. All of the servo stuff is driven from the one 16 bit timmer. Don't use the other 2, 8 bit timers or you will mess up the delay() function. I don't even use the millis() function, the main loop is interrupt driven. Just please put me in the credits if you use my code. BTW i was planning on doing just what you are attempting, ass soon as I finish hacking my transmitter to interface with the IMU3 head tracker.

This reply was deleted.

Activity