BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINMODE

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
schmo90
Posts: 3
Joined: Sun Dec 29, 2013 11:33 am

BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINMODE

Post by schmo90 »

Hallo everyone

I am softwaredeveloper but i didnt found the solution in the source, so decided to use this forum.

I want to use the buzzer (led and sound) and i want to use my 2 aux inputs.
I have the turnigy 9x receiver so i have to use every available pin.

So my big problem is:
Buzzer should be on TX => but TX is always pulled up to 5V, no idea why..
so i swiched with the buzzer to D8 => works very fine :-)
But the bad side effect is, now i am not able to use aux 1 :-(

I tried also the override definations
OVERRIDE_BUZZERPIN_PINMODE, but nothing happens on A2.

So my questions is there any hack to use buzzer and this 2 aux?
I looked into the source but i found nothing which worked.

Where can i find which Pin is used and how can i use a different pin for my porposes?
pinMode says what the pin is
But where can i find which pins a grouped into PORTC or PORTB .... ?
Is there anywhere a definition of the PORT"X" - Grouping??

Code: Select all

//  #define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A1, OUTPUT); // use A2 instead of d8
//  #define OVERRIDE_BUZZERPIN_ON              PORTC |= (1<<1);   //PORTB |= 1;
//  #define OVERRIDE_BUZZERPIN_OFF              PORTC &= ~(1<<1); //PORTB &= ~1;


i built my nanowii quadrocopter in the last few month.
My setup ist
nanowii
turnigy9x normal tx and rx
baro and magneto sensors


Thanks for your help
Last edited by schmo90 on Sun Dec 29, 2013 12:58 pm, edited 1 time in total.

schmo90
Posts: 3
Joined: Sun Dec 29, 2013 11:33 am

Re: NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINMODE

Post by schmo90 »

It is a bug in the software and i found it :-) :D

This is wrong for the nanowii!!!

Code: Select all

#define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A2, OUTPUT); // use A2 instead of d8
  #define OVERRIDE_BUZZERPIN_ON               PORC |= (1<<2);   //PORTB |= 1;
  #define OVERRIDE_BUZZERPIN_OFF              PORTC &= ~(1<<2); //PORTB &= ~1;




NanoWii is based on Atmega32u4 and there is A2 on PortF and NOT on PortC
So i changed this definations to

Code: Select all

#define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A2, OUTPUT); // use A2 instead of d8
  #define OVERRIDE_BUZZERPIN_ON               PORTF |= (1<<5);   //PORTB |= 1;
  #define OVERRIDE_BUZZERPIN_OFF              PORTF &= ~(1<<5); //PORTB &= ~1;


And my Buzzer is now on A2 :-)
And now i makes annoying sounds if the lipo is low :-)

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

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by Hamburger »

Ok. I will add extra comment for all override options.

tjamaker
Posts: 16
Joined: Wed Jan 22, 2014 11:40 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by tjamaker »

Hallo,

ich habe auch ein NanoWii 1.0 Board. Ich habe einen simplen Spannungsteiler an die den PIN A3 angeschlossen. Die Dimensionierung des Spannungsteiler habe ich aus dem Dokument NanoWii FC User Manual Version 1.1.
Ich habe verschiedenen Einstellungen probiert, nur alle leider ohne dass ich irgendein Geräusch oder sonstiges Signal sehen konnte.
Hier sind meine Einstellungen:

Code: Select all

    #define OVERRIDE_PSENSORPIN                 A3 // instead of A2    // Analog PIN 2

    #define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A3, OUTPUT); // use A3 instead of d8
    #define OVERRIDE_BUZZERPIN_ON               PORTC |= 1<<2 //PORTB |= 1;
    #define OVERRIDE_BUZZERPIN_OFF              PORTC &= ~(1<<2); //PORTB &= ~1;

    #define BUZZER
    #define RCOPTIONSBEEP         // uncomment this if you want the buzzer to beep at any rcOptions change on channel Aux1 to Aux4
    #define ARMEDTIMEWARNING 330  // (*) Trigger an alarm after a certain time of being armed [s] to save you lipo (if your TX does not have a countdown)
    //#define PILOTLAMP             //Uncomment if you are using a X-Arcraft Pilot Lamp


Wie kann ich rausfinden, auf welchen Port dieser PIN A3 ab Controller geht? Und wie ich shiften muss?


Gruß
tjamaker

scrat
Posts: 925
Joined: Mon Oct 15, 2012 9:47 am
Location: Slovenia

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by scrat »

tjamaker wrote:Hallo,

ich habe auch ein NanoWii 1.0 Board. Ich habe einen simplen Spannungsteiler an die den PIN A3 angeschlossen. Die Dimensionierung des Spannungsteiler habe ich aus dem Dokument NanoWii FC User Manual Version 1.1.
Ich habe verschiedenen Einstellungen probiert, nur alle leider ohne dass ich irgendein Geräusch oder sonstiges Signal sehen konnte.
Hier sind meine Einstellungen:

Code: Select all

    #define OVERRIDE_PSENSORPIN                 A3 // instead of A2    // Analog PIN 2

    #define OVERRIDE_BUZZERPIN_PINMODE          pinMode (A3, OUTPUT); // use A3 instead of d8
    #define OVERRIDE_BUZZERPIN_ON               PORTC |= 1<<2 //PORTB |= 1;
    #define OVERRIDE_BUZZERPIN_OFF              PORTC &= ~(1<<2); //PORTB &= ~1;

    #define BUZZER
    #define RCOPTIONSBEEP         // uncomment this if you want the buzzer to beep at any rcOptions change on channel Aux1 to Aux4
    #define ARMEDTIMEWARNING 330  // (*) Trigger an alarm after a certain time of being armed [s] to save you lipo (if your TX does not have a countdown)
    //#define PILOTLAMP             //Uncomment if you are using a X-Arcraft Pilot Lamp


Wie kann ich rausfinden, auf welchen Port dieser PIN A3 ab Controller geht? Und wie ich shiften muss?


Gruß
tjamaker



Hallo tjamaker...

please write in english language. Unfortunately, all people here doesn't understand German. Thanks!

tjamaker
Posts: 16
Joined: Wed Jan 22, 2014 11:40 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by tjamaker »

Oh, I'm sorry. But I was just clearing my thoughts and therefore I wrote in german.

Hi,

I have also a NanoWii 1.0 Board. I have put a simple potential divider on Pin A3. I can read the Voltage Level which is displayed in the MultiWiiConf-GUI.
But I'm trying to toggle a LED-Pin to switch a LED-Stripe on when Volateg Level is low. But I have no success. Here are my seetings from the config.h:

Code: Select all

  #define NANOWII         // the smallest multiwii FC based on MPU6050 + pro micro based proc <- confirmed by Alex

  #define OVERRIDE_V_BATPIN                   A3 // instead of A3    // Analog PIN 3

  #define OVERRIDE_LEDPIN_PINMODE             pinMode (A2, OUTPUT); // use A1 instead of d13
  #define OVERRIDE_LEDPIN_TOGGLE              PINF |= 1<<5;
  #define OVERRIDE_LEDPIN_OFF                 PORTF &= ~(1<<5);
  #define OVERRIDE_LEDPIN_ON                  PORTF |= 1<<5;

  //#define LED_FLASHER

  #define VBAT              // uncomment this line to activate the vbat code
  #define VBATSCALE       131 // (*) (**) change this value if readed Battery voltage is different than real voltage
  #define VBATNOMINAL     126 // 12,6V full battery nominal voltage - only used for lcd.telemetry
  #define VBATLEVEL_WARN1 107 // (*) (**) 10,7V
  #define VBATLEVEL_WARN2  99 // (*) (**) 9.9V
  #define VBATLEVEL_CRIT   93 // (*) (**) 9.3V - critical condition: if vbat ever goes below this value, permanent alarm is triggered
  #define NO_VBAT          16 // Avoid beeping without any battery


Perhaps I have missed some settings, but these are the most important I think.

Please help me out!

Greets
tjamaker

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

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by Hamburger »

The alarms code uses the buzzer for signaling.
So use override.buzzer.pin to point to your optical buzzer i.e. leds

tjamaker
Posts: 16
Joined: Wed Jan 22, 2014 11:40 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by tjamaker »

Sorry, but I do not understand you.
What do you mean with override.buzzer.pin? This seems to be source code. This is not a define, isn't it?
How can point this to my optical buzzer? Shall I write override.led.pin? And where shall I do this? Can you tell me the cpp-file?


Greets
tjamaker

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

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by Hamburger »

No. It is in config.h and I type it like this on my phone without capital letters and underscore

tjamaker
Posts: 16
Joined: Wed Jan 22, 2014 11:40 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by tjamaker »

OK, that's OK.

But there is still my problem with the Outputs. Every Pin (A0 to A4) I can configure as Input. And I can meassure the Voltage Levels. But I didn't get it work as an Output...

Please help me out. Is there any way to debug this with trace messages? And if yes, how can I display these trace messages (serial port, usb port, in MultiWiiConf-GUI, ...).


Greet
tjamaker

happul3
Posts: 44
Joined: Mon Apr 21, 2014 1:54 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by happul3 »

tjamaker wrote:OK, that's OK.

But there is still my problem with the Outputs. Every Pin (A0 to A4) I can configure as Input. And I can meassure the Voltage Levels. But I didn't get it work as an Output...

Please help me out. Is there any way to debug this with trace messages? And if yes, how can I display these trace messages (serial port, usb port, in MultiWiiConf-GUI, ...).


Greet
tjamaker


Do you explicitly set the pin as output? Something like "pinMode (A4, OUTPUT);" or with DDRx register? I mean, just add a line like that, without relying on #define's.

tjamaker
Posts: 16
Joined: Wed Jan 22, 2014 11:40 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by tjamaker »

No I didn't. You mean just in the SetUp-Code of the MultiWii to check if is workin.
I will check it tomorrow.

chronister
Posts: 14
Joined: Fri Nov 28, 2014 2:17 am

Re: BUG_NANOWII: Use AUX1 and Buzzer OVERRIDE_BUZZERPIN_PINM

Post by chronister »

Schmo90 Thank you for posting the correct code for reassigning the buzzer. Does anyone know how to assign it to the Spek.sat connector? That would be ideal because if I solder the wires directly onto the board (at A2 for example), they are going to fray and break. Thanks!

Post Reply