Page 1 of 1
Changing PPM sum input pin.
Posted: Tue May 01, 2012 7:38 am
by Matt.
Hi Guys,
I had a bad crash an managed to kill the PPM Sum input pin and now and am trying to find the place to change it in the code.
Anyone point me to the section of code where this could be done please

Thanks in advance
Matt
Re: Changing PPM sum input pin.
Posted: Tue May 01, 2012 1:31 pm
by copterrichie
The only other possibility would be Pin number 3 but it is used by one of the motors, so that would have to be changed also. There are only two external Interrupts on the 328. With the cost of Pro Mini at bout 10 US dollars, maybe better to just get a new one.
Re: Changing PPM sum input pin.
Posted: Tue May 01, 2012 1:42 pm
by Matt.
I am using a Crius SE board. I have discovered int1 and tried changing the define for the PPM_PIN_INTERRUPT FROM
attachInterrupt(0, rxInt, RISING);
TO
attachInterrupt(1, rxInt, RISING);
and changed that pin to an input by changing
PORTD = (1<<2) | (1<<4) | (1<<5) | (1<<6) | (1<<7); //enable internal pull ups on the PINs of PORTD
to
PORTD = (1<<3) | (1<<4) | (1<<5) | (1<<6) | (1<<7); //enable internal pull ups on the PINs of PORTD
but it's not working. Im not a that familiar with these micros what other registers do I need to set??
Thanks in Advance
Matt
Re: Changing PPM sum input pin.
Posted: Wed May 02, 2012 7:01 am
by ronco
Hi,
Code: Select all
attachInterrupt(1, rxInt, RISING);
is right, but as copterrichie said pin 3 is used as an output pin to use it as input you have to
change a output pin.. and that isnt so easy. because pin !=pin

regards
Felix
Re: Changing PPM sum input pin.
Posted: Thu May 03, 2012 9:04 am
by Matt.
Hi Felix,
So after reading up and getting a little familiar with the platform and the multiwii code I have successfully moved the PPM sum input pin to Digital Pin 3.
I am now trying to enable the PWM for digitial pin 5 to replace the motor output lost 3.
So far I have:
Changed the PWM_PIN array to:
uint8_t PWM_PIN[8] = {9,10,11,5,6,8,A2,12}; //for a quad+: rear,right,left,front
Changed the ProMini section of the motor write to :
#if (NUMBER_MOTOR > 3)
#ifndef EXT_MOTOR_RANGE
OCR0B = motor[3]>>3; // pin 5
#else
OCR0B = ((motor[3]>>2) - 250) + 2;
#endif
and changed the initOutput function case to:
TCCR0A = _BV(WGM01) | _BV(WGM00);
TCCR0B = _BV(CS02);
TCCR0A |= _BV(COM0B1); // connect pin 5 to timer 0 channel B
however changing the waveform generation mode bit in the TCCR0A register seems to halt the program.
Can someone assist in how to set up and activate the PWM on Digial Pin 5 correctly please..
Matt
Re: Changing PPM sum input pin.
Posted: Fri May 04, 2012 12:58 am
by ronco
Matt. wrote:Hi Felix,
So after reading up and getting a little familiar with the platform and the multiwii code I have successfully moved the PPM sum input pin to Digital Pin 3.
I am now trying to enable the PWM for digitial pin 5 to replace the motor output lost 3.
So far I have:
Changed the PWM_PIN array to:
uint8_t PWM_PIN[8] = {9,10,11,5,6,8,A2,12}; //for a quad+: rear,right,left,front
Changed the ProMini section of the motor write to :
#if (NUMBER_MOTOR > 3)
#ifndef EXT_MOTOR_RANGE
OCR0B = motor[3]>>3; // pin 5
#else
OCR0B = ((motor[3]>>2) - 250) + 2;
#endif
and changed the initOutput function case to:
TCCR0A = _BV(WGM01) | _BV(WGM00);
TCCR0B = _BV(CS02);
TCCR0A |= _BV(COM0B1); // connect pin 5 to timer 0 channel B
however changing the waveform generation mode bit in the TCCR0A register seems to halt the program.
Can someone assist in how to set up and activate the PWM on Digial Pin 5 correctly please..
Matt
Hi Matt,
you cant use pin 5 or 6 for it , because timer 0 runs at 976Hz .. and we need 488Hz to be able to send a 2ms dutytime. and we cant change its frequency because arduino uses it for the time functions like micros and delay.
because of this we do motor 5 & 6 with Software PWM on the Promini
so the easyer way would be to change the hexa mix (which uses this software PWM on pin 5 & 6) to fit for a quad with this pins
example:
select HEX6X and change its mix in Output.pde like this (untested)
Code: Select all
#ifdef HEX6X // now quad x with pin 9,10,11,6
motor[0] = 1000; // pin 3 .. not used
motor[1] = PIDMIX(-1,+1,-1); //REAR_R -> pin 9
motor[2] = PIDMIX(-1,-1,+1); //FRONT_R -> pin 10
motor[3] = PIDMIX(+1,+1,+1); //REAR_L -> pin 11
motor[4] = PIDMIX(+1,-1,-1); //FRONT_L -> pin 6
motor[5] = 1000; // pin 5.. not used
#endif
regards
Felix
Re: Changing PPM sum input pin.
Posted: Tue Jan 01, 2013 5:09 pm
by dialfonzo
Hi copterrichie,
Do you think the thing is doable if the motor output pin is changed ?
Since i am not a programmer, just understand basic of programmation, could you do a sample multiwii file so i can test it ?
Thanks a lot
viewtopic.php?f=15&t=2888&p=28553#p28553Eric Nantel - DiaLFonZo
Re: Changing PPM sum input pin.
Posted: Fri Jan 04, 2013 10:32 am
by QuadBow
Hi all,
I would like to make you aware that the development release r1240 supports the change of the PPM sum input pin.
This feature can be enabled by uncommenting the line
#define PPM_ON_THROTTLE
in the file config.h.
As a result of this change, the sum input has to be made avaliable at the standard throttle pin on MEGA boards (eg. A8 for CRIUS AIO and FLYDUINO MEGA) and PROMICRO boards. Due to my obvervation, there is no big impact to cycle time. Being familiar with the code it should be possible to use another unused INT- or PCINT-pin instead of INT6_vect (PROMICOR) or PCINT2_vect (MEGA), as well (RX.INO).
I think this feature helps those who have an RX/TX issue.
Good luck
Re: Changing PPM sum input pin.
Posted: Sat Jan 05, 2013 2:06 pm
by dialfonzo
QuadBow wrote:Hi all,
I would like to make you aware that the development release r1240 supports the change of the PPM sum input pin.
This feature can be enabled by uncommenting the line
#define PPM_ON_THROTTLE
in the file config.h.
As a result of this change, the sum input has to be made avaliable at the standard throttle pin on MEGA boards (eg. A8 for CRIUS AIO and FLYDUINO MEGA) and PROMICRO boards. Due to my obvervation, there is no big impact to cycle time. Being familiar with the code it should be possible to use another unused INT- or PCINT-pin instead of INT6_vect (PROMICOR) or PCINT2_vect (MEGA), as well (RX.INO).
I think this feature helps those who have an RX/TX issue.
Good luck
First, thanks for trying to help.,.

I don't understand that "#define PPM_ON_THROTTLE" since the ppm was already originaly on the throttle pin.
Eric
Re: Changing PPM sum input pin.
Posted: Sat Jan 05, 2013 8:33 pm
by QuadBow
First, thanks for trying to help.,.

I don't understand that "#define PPM_ON_THROTTLE" since the ppm was already originaly on the throttle pin.
Eric
Hi Eric,
The definition PPM_ON_THROTTLE is maybe misleading since we are talking about the PPM SUM input pin.
This sum pin replaces the pins of ALL channels and is usually connected to serial 1. Since the originator of this thread got an issue with this serial 1, I informed about the possibility to change the sum input pin from serial 1 to the throttle pin.
Best wishes
Re: Changing PPM sum input pin.
Posted: Sun Mar 09, 2014 9:37 pm
by i3dm
Hello guys,
on one of my Crius SE boards i think i have a problem with PPM on throttle pin. if i connect there the RC signals go crazy, and in another identical board it works 100% fine with the same code.
how can i change the PPM SUM input pin to the Crius SE board to lets say A7?
i dont want to use A8 as my board only has the following sockets available:
A0
A1
A2
A3
A6
A7
Re: Changing PPM sum input pin.
Posted: Mon Mar 10, 2014 12:38 am
by Spacefish
You are limited to some pins in the current software, as you can only use pins that generate a interrupt. This is due a hardware limitation (not all pins generate a interrupt).
Another way would be to use the ICPX pins (ICP1-ICP5 on Mega 2560). But you have to change the code / initialize the timers to capture those events..
I have done this for my CRIUS AIO Pro V2 as the PPM pin on the PCB is connected to ICP1 which can´t generate a Interrupt in a way MultiWii currently accepts.. See my Code here:
viewtopic.php?f=8&t=4788
Re: Changing PPM sum input pin.
Posted: Mon Mar 10, 2014 10:59 pm
by i3dm
Spacefish wrote:You are limited to some pins in the current software, as you can only use pins that generate a interrupt. This is due a hardware limitation (not all pins generate a interrupt).
Another way would be to use the ICPX pins (ICP1-ICP5 on Mega 2560). But you have to change the code / initialize the timers to capture those events..
I have done this for my CRIUS AIO Pro V2 as the PPM pin on the PCB is connected to ICP1 which can´t generate a Interrupt in a way MultiWii currently accepts.. See my Code here:
viewtopic.php?f=8&t=4788
Thanks but im using a Crius SE with Atmega 328P.
Re: Changing PPM sum input pin.
Posted: Mon Mar 17, 2014 3:34 pm
by denism
What about NanoWii, Atmega 32u4 based board? Can PPM SUM be moved to another pin? If so, which one?
On my board default PPM pin (throtle) is pulled to Vcc (fried Atmega?)