how to change pin output (pin 3 fried...)

Post Reply
confrey
Posts: 6
Joined: Sun Jun 09, 2013 12:36 pm

how to change pin output (pin 3 fried...)

Post by confrey »

hi everybody, as said in topic, the PIN 3 of my FC HK Multiwii 328p has gone... at the moment I'm using a tricopter configuration, it was flying well, after a crash, I had to re-assmbly all again, and, may be, I made some errors with cables, now I have the three rotors working well, but no response from servo; servo is okay, all cables are okay, I tested all them singularly, so the only thing to think is PIN 3 is fried. I haven't another FC to use, on that board the PIN 12 is near PIN 11, so I only need to exchange PIN 3 output with PIN 12 output, knowing well that FC will not pilote more than three rotors anymore, but that's all, it'd be enough at the moment.
I tried to study a little the MultiwII code (2.2), I've some knowledges about C, Pearl, I'm using Linux so I know what a terminal is and so on... but my knowledge about it's not enough to solve this problem, neither I have so much time to study all the code to solve it myself.
Please, guide me to modify the code, I want to test my new frame....

thanks

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

Re: how to change pin output (pin 3 fried...)

Post by Hamburger »

Sorry to say it is not a standard procedure.
So if you have to ask then probably it is not for you.
You must find pin order for your mcu and servo to pin relation and servo to pin signaling and change all that.
Or re.use another coptertype and change that mixing maybe

confrey
Posts: 6
Joined: Sun Jun 09, 2013 12:36 pm

Re: how to change pin output (pin 3 fried...)

Post by confrey »

thanks for your reply, I know I'm so expert, but I can try to do something about, I ask for help because it's no simple understanding all multiwii code starting from scratch, if anybody can suggest me where may I find relation between PIN and signal, it'd be a good start; I tried to exchange this values 3 and 12 in def.h , in lines defining SERVO_4_PINMODE and SERVO_6_PINMODE, to redirect the rear servo in tri configuration on PIN 12 instead of PIN 3, and vice versa, but I had no result, the servo is not moving; may be I need to change something else, but I don't know what and where; help about will be appreciated... :)

regards and thanks

confrey

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

Re: how to change pin output (pin 3 fried...)

Post by PatrikE »

Test to replace this in def.h
Aroun row 360.

Code: Select all

  #define SERVO_6_PINMODE            pinMode(3,OUTPUT);  // TRI REAR - BI RIGHT
  #define SERVO_6_PIN_HIGH           PORTD|= 1<<3;
  #define SERVO_6_PIN_LOW            PORTD &= ~(1<<3);


with this

Code: Select all

  #define SERVO_6_PINMODE            pinMode(3,OUTPUT);pinMode(12,OUTPUT);  // TRI REAR - BI RIGHT
  #define SERVO_6_PIN_HIGH           PORTD|= 1<<3;PORTB |= 1<<4;
  #define SERVO_6_PIN_LOW            PORTD &= ~(1<<3);PORTB &= ~(1<<4);


should output servosignal on D3 & D12 simultaneously.
This is from the 2.3_pre code

Not tested but it's how it's done on MegaBoards.

confrey
Posts: 6
Joined: Sun Jun 09, 2013 12:36 pm

Re: how to change pin output (pin 3 fried...)

Post by confrey »

done, but I canceled all code regarding PIN 3, and, (WOW) it works! I have a servo moving now, connected to PIN 12;
may it be the same thing if I wish to configure a quad (Y4 in my case)? all work made by PIN 3 will it be done by PIN 12? or have I to change anything else ( I saw some code lines regarding a numeric order of rotors)

bye

Post Reply