Plane mode on Mega (1280) board: Not running, Issues on PWM?

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
KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Plane mode on Mega (1280) board: Not running, Issues on PWM?

Post by KaiK »

Hi guys,

did one of you successfully run Plane mode on a mega board?

I have connected everything correctly (using D2 for rudder, D3 for engine, D5 for elev and D6 for the wings) but the servos are going crazy and the ESC is beeping (no signal).
Du to that I analyzed the the PWM signal with a oszi and I think somethin is going wrong there.

To ensure correct measurement with the oszi I have analyzed the signals on the four pins (D2, D3, D5, D6) in QuadX mode. There they give a nice 2ms signal. Additionally I have tested with Arduino Servo library, which gives a nice signal too.

In airplane mode (passthru as well as gyro and acc) the PWM looks very strange: Its periodlength jumps between the discrete values 20,4ms, 24,4ms and 28,4ms.
The high period only jumps between the discrete values 1,2ms and 5,2ms when the corresponding channel is changing. (5,2ms on bootup of Arduino, holds at 1,2ms or 5,2 forever [didnt see the systematic) when stick moved left/right (or top/down). While moving it is jumping between 1,2 and 5,2ms. ).

As you can see: very crazy.

To sum up: In QuadX the signal is as expected, with Arduino servo library the signal is as expected, in airplane mode is is crazy as described.

My setup: Seeduino Mega 1280, MPU6050
Measurement with Fluke 196 Scopemeter

Do you have any idea on this?

Thank you
Kai

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

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Hamburger »

Me not. Only 328p working.

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

Hi guys,

just checked it with my todays arriving Arduino Uno. It gives a clear and good PWM signal.
So I think there is something wrong with the implemetation for Mega boards.

Unfortunately I am not very familiar with all the timers/interupts stuff. Does someone of you have an idea where to search/how to fix the bug?

Regards
Kai

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

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Hamburger »

In shared MIS did correct an error with interrupts on mega mcu. Maybe that helps?

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

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Alexinparis »

In airplane mode (passthru as well as gyro and acc) the PWM looks very strange: Its periodlength jumps between the discrete values 20,4ms, 24,4ms and 28,4ms.
The high period only jumps between the discrete values 1,2ms and 5,2ms when the corresponding channel is changing. (5,2ms on bootup of Arduino, holds at 1,2ms or 5,2 forever [didnt see the systematic) when stick moved left/right (or top/down). While moving it is jumping between 1,2 and 5,2ms. ).


The problem has nothing to do with interrupts, and should not be a problem ;)

The way to generate software PWM for servo uses a variable period because one timer is used to generate several servo pulse.
The important thing is the HIGH state period (value of the servo command), the DOWN state duration is less important and is around 18ms

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

Hi guys,

maybe it wasnt clear. The high period doesnt change like expectet. The GUI shows the expectet values, but the high signal only jumps between 1,2ms and 5,2ms (nothing between this). It jumps when not armed (idle), too...

The servos are going crazy with this..

May a video of the oszi measurement help you?

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Gimbal »

Any luck with MIS improvment ?
http://code.google.com/p/multiwii/source/list
Last edited by Gimbal on Tue Sep 11, 2012 7:35 pm, edited 1 time in total.

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

AW: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

Couldnt check it until now.
What do you mean with MIS?

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

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Hamburger »

Mis is a dev who fixed a bug with itr for mega. code is in shared.
(fixed some typos)
Last edited by Hamburger on Sat Sep 15, 2012 11:19 pm, edited 1 time in total.

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

I tried it some minutes ago with the latest checkout from Shared, but it is still the same. High periods of PWM is jumping between 1ms and 5ms when the GUI indicates a changing (eg. when moving the IMU -> changing servo signals, moving throttle stick -> changing ESC signal)...

This is really weird...

Gimbal
Posts: 146
Joined: Tue Jul 24, 2012 7:14 pm
Location: Sweden

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by Gimbal »

Hi KaiK, found a bug in output:

#if defined(AIRPLANE)|| defined(HELICOPTER)
// To prevent motor to start at reset. atomicServo[7]=5 or 249 if reversed servo
volatile uint16_t atomicServo[8] = {8000,8000,8000,8000,8000,8000,8000,8000};

change uint8 to uint16

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

Great. I will try it and scope it tomorrow.

PatrikE
Posts: 1976
Joined: Tue Apr 12, 2011 6:35 pm
Location: Sweden
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by PatrikE »

Fix is uploaded in _shared.

KaiK
Posts: 58
Joined: Thu Jul 28, 2011 8:32 pm
Contact:

Re: Plane mode on Mega (1280) board: Not running, Issues on

Post by KaiK »

Checked it with a scope and made a little test in airplane (on ground): Seems to fix it!

Post Reply