"Arduino" Pro Micro

This forum is dedicated to software development related to MultiWii.
It is not the right place to submit a setup problem.
Software download
ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

"Arduino" Pro Micro

Post by ronco »

Hi,

i have seen the new Pro Micro from sparkfun http://www.sparkfun.com/products/10998.
it is the same size with pro mini but with the "Leonardo" ATMega 32U4

it has some benefits but also some disadvantages compared with pro mini...

as far as i know..

benefits:
- usb onboard
- more RAM? (aBUGSworstnightmare told me the more RAM it has is taken by the USB )
- high resolution PWM timers.. some 10bit (= 1023steps?) and some 16bit (= more then 1023 but i dont know it)
- a free UART.. can be used for GPS right?

disadvantages:
- less pins
- only 6 PCINT pins (two of them may be taken by PWM if we want to use HW PWM = 4 free PCINT pins)
- pin 2 & 3 are taken by SDA & SCL


a pin plan i made for it :)
Pro micro.jpg



is the community interestet to support it with MWC?


regards

Felix

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: "Arduino" Pro Micro

Post by copterrichie »

Time to renew the I2C-ESC. Hmmm

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: "Arduino" Pro Micro

Post by Danal »

GUI Config via USB, the USART for Spektrum satellite? Yes, I'm interested.

What do we need to do?

I'll order a couple today.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: "Arduino" Pro Micro

Post by ziss_dm »

Hi
Teensy++ - same price, 128k flash, 8k sram, 6x 16bit compare units. 4x 8bit compare units.
So, what is the point? ;)

regards,
ziss_dm

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: "Arduino" Pro Micro

Post by Danal »

ziss_dm wrote:Hi
Teensy++ - same price, 128k flash, 8k sram, 6x 16bit compare units. 4x 8bit compare units.
So, what is the point? ;)

regards,
ziss_dm


Same price, Hmmm... Might have to order a couple of these as well. Ziss do you have one in hand?

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: "Arduino" Pro Micro

Post by copterrichie »

This is the greatest feature of Open Source Software, it keeps up with the changes in hardware and brilliant minded people.

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

ziss_dm wrote:Hi
Teensy++ - same price, 128k flash, 8k sram, 6x 16bit compare units. 4x 8bit compare units.
So, what is the point? ;)

regards,
ziss_dm

Hi ziss,

thay are may good AVRs that may be used...

i first saw this one http://www.adafruit.com/products/296 .. it has the same avr as pro micro.. more pins and a 3.3 v out ...

but i think using arduino is hard enough for the moust people.. if thay need to flash a bootloader or something like that it becomes too much..

the pro micro is something like "pro mini 2.0" the same usage the same sellers and in future build in arduino (there is a pins_arduino.h for it in arduino/hardware/arduino/variants/)

so i think its the best choice...


Danal wrote:What do we need to do?


i think we need to do some tests with it (i ordered one too ;) )..

i did some thoughs about a possible pin usage for it
ProMicro_pinSetup.jpg

but i dont know the timers possible frequencys ... i hope they are usable for us.


regards Felix

itain
Posts: 75
Joined: Tue Aug 23, 2011 10:32 pm

Re: "Arduino" Pro Micro

Post by itain »

In the past I started a thread asking about Teensy possible support. These USB chips have very few pins that support pin-change interrupt. After reviewing possible connections I agree that there is no real advantage over the very popular ATMega328p.

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: "Arduino" Pro Micro

Post by Danal »

Spektrum will not use the TX pin, only the RX.

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

ok thanks ..

i also dont know if we can unse the PCINT pins and the interrupt of rx and tx at one time.. we will see :)

regards

Felix

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: "Arduino" Pro Micro

Post by Danal »

ronco wrote:ok thanks ..

i also dont know if we can unse the PCINT pins and the interrupt of rx and tx at one time.. we will see :)

regards

Felix


Per the datasheet, there is a USART for RX and TX. That should make the interrupts for USART1 serial communications totally independent of anything else.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: "Arduino" Pro Micro

Post by timecop »

ronco wrote:i did some thoughs about a possible pin usage for it
ProMicro_pinSetup.jpg

but i dont know the timers possible frequencys ... i hope they are usable for us.


regards Felix


What a horrible waste of hardware in the name of tarduino.
Why does a 48 pin chip only have like 16 pins broken out? The mind boggles.

Stuff like this shouldn't be supported - let the greedy vendor know by not buying their junk.

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: "Arduino" Pro Micro

Post by ziss_dm »

Hi Ronco,

but i think using arduino is hard enough for the moust people.. if thay need to flash a bootloader or something like that it becomes too much..


If we are still talking about Teensy, you do not need to flash bootloader as it comes preprogrammed. ;)

@Danal: yes, I have couple. ;)

regards,
ziss_dm

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

dongs wrote:What a horrible waste of hardware in the name of tarduino.
Why does a 48 pin chip only have like 16 pins broken out? The mind boggles.

Stuff like this shouldn't be supported - let the greedy vendor know by not buying their junk.


:P

i count 44pins on the chip .. but there are 5 usable pins not broken out on pro micro (the others are for usb rx tx led ....)
i also think thay may do it better .. but as i said .. if we dont want to make MWC to special .. i think we need to take the common stuff..

regards Felix

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: "Arduino" Pro Micro

Post by copterrichie »

IMO, if we are not talking about moving to a 32bit chip, then it would be best to stay with the present Adruino.

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: "Arduino" Pro Micro

Post by timecop »

The most sensible reply in this entire thread is above.

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: "Arduino" Pro Micro

Post by aBUGSworstnightmare »

Hi there,

well, why shouldn't we think a little bit more about what's on the schedule in the near future? The Arduino 'Leonardo' was announced on the Maker Fair last year (http://arduino.cc/blog/2011/09/17/ardui ... ker-faire/). It is based around the Atmega32u4 and there will be a special official Arduino boot loader (CDC class) for it available for shure. So, this will not be a problem for the user.

The device will help us to break the limitations of the promini (fewer PWM's, only one UART) since it has lot's of PWM's (four of them high speed ones - up to 48MHz when USB is in use) and the USB for communication with the PC (--> FTDI is no longer needed). The UART will be available all the time to use with a Spektrum Sat, GPS, Bluetooth, ..). And, it's cheaper than a mega328P.

Since the Atmega32U4 is a 44-pin device we will not see any limitations when comparing it with the mega328P. The Teensy and the Ardafruit implementation were not the best for using it with MWC from my point of view --> maybe there will be a better one in the future.

The only problem at the moment is the lack of an official bootlaoder; a Leonardo header (which is remapping I/O and definitions) is already available with Ardiuino V1.0 --> implementing the software should be possible with adding simple 'defines (as with the mega).

Rgds
aBUGSworstnightmare

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

aBUGSworstnightmare wrote:The only problem at the moment is the lack of an official bootlaoder; a Leonardo header (which is remapping I/O and definitions) is already available with Ardiuino

Hi,

the bootloader is alredy in Arduino 1.0 .. to use it you need to uncomment the leonardo part in hardware/arduino/boards.txt
(remove the "#"s in front of the lines)
and the Pro Micro comes with this bootloader -> http://www.sparkfun.com/tutorials/338

i dont recived my Pro Micro yet .. i hope i have it soon..

i alredy started to make MWC compatible ;P

but i have some questions to people that knows the atmega32_u4

for HW PWM we have pin 10, 9, 6 and 5 (PB6, PB5, PD7 and PC6) ... pin 3 (PD0) is used for SCL
PB7 and PC7 are not broken out on Pro Micro

possible timers for this pins are:

10 = 1B or 4B
9 = 1A or 4B
6 = 4D
5 = 3A or 4A

so i think its best to use them linke:

10 = 1B
9 = 1A
6 = 4D
5 = 4A

questions:

1. timer 4 is the high speed timer right? if it is .. is it possible to prescale it to a frequency under 500Hz?

2. i had some problems with serial stuff .. so is the usb also used like a serial port?

3. UDR0 is not defined (arduino says that) so i replaced it with UDR1 for pro micro .. is UDR1 now the USB or the USART?

Thanks ! :)

Regards

Felix

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: "Arduino" Pro Micro

Post by aBUGSworstnightmare »

ronco wrote:
aBUGSworstnightmare wrote:The only problem at the moment is the lack of an official bootlaoder; a Leonardo header (which is remapping I/O and definitions) is already available with Ardiuino

Hi,

the bootloader is alredy in Arduino 1.0 .. to use it you need to uncomment the leonardo part in hardware/arduino/boards.txt
(remove the "#"s in front of the lines)
and the Pro Micro comes with this bootloader -> http://www.sparkfun.com/tutorials/338

i dont recived my Pro Micro yet .. i hope i have it soon..

i alredy started to make MWC compatible ;P

but i have some questions to people that knows the atmega32_u4

for HW PWM we have pin 10, 9, 6 and 5 (PB6, PB5, PD7 and PC6) ... pin 3 (PD0) is used for SCL
PB7 and PC7 are not broken out on Pro Micro

possible timers for this pins are:

10 = 1B or 4B
9 = 1A or 4B
6 = 4D
5 = 3A or 4A

so i think its best to use them linke:

10 = 1B
9 = 1A
6 = 4D
5 = 4A

questions:

1. timer 4 is the high speed timer right? if it is .. is it possible to prescale it to a frequency under 500Hz?

2. i had some problems with serial stuff .. so is the usb also used like a serial port?

3. UDR0 is not defined (arduino says that) so i replaced it with UDR1 for pro micro .. is UDR1 now the USB or the USART?

Thanks ! :)

Regards

Felix


Hi Felix,

1.) The maximum count clock (PCK) for Timer 4 is 48MHz when using USB (since USB needs PCK = 48MHz) --> maximum prescale setting is PCK/16384

2.) Just imagine your ProMicro has two separte serial ports:

Serial.println("Hello world"); // Print "Hello World" to the Serial Monitor--> that's the USB interface!!!
Serial1.println("Hello!"); // Print "Hello!" over hardware UART1 (TXD1 = PD3) --> simply test it with an FTDI (*lol*) connected to the UART

3.) UDR1 is for UART

4.) http://mikrocontroller-praxis.de/de/Dev ... Board.html --> PB7 and PC7 were both available --> will try the Sparkfun Bootloader with it (should be this one: https://github.com/arduino/Arduino/tree ... diskloader)!

aBUGsworstnightmare

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

thanks!

but that are bad news ... :(

if Timer 4 need to run at 48Mhz to use the usb .. the lowest HW PWM frequency would be 48000000/16384 = 2929Hz
eaven with a nother board with PB7 and PC7 broken out we will need timer 4 for HW PWM

so we have just 2 / (3 with PB7 broken out ) usable HW PWM pins...


aBUGSworstnightmare wrote:3.) UDR1 is for UART

hmm then i have no idea how to use the usb with MWC serial code .. because arduino says UDR0 (i think this would be for usb) is not defined :(


i will try it anyway :)


Regards

Felix

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: "Arduino" Pro Micro

Post by aBUGSworstnightmare »

ronco wrote:thanks!

but that are bad news ... :(

if Timer 4 need to run at 48Mhz to use the usb .. the lowest HW PWM frequency would be 48000000/16384 = 2929Hz
eaven with a nother board with PB7 and PC7 broken out we will need timer 4 for HW PWM

so we have just 2 / (3 with PB7 broken out ) usable HW PWM pins...


aBUGSworstnightmare wrote:3.) UDR1 is for UART

hmm then i have no idea how to use the usb with MWC serial code .. because arduino says UDR0 (i think this would be for usb) is not defined :(


i will try it anyway :)


Regards

Felix


Felix,

you can use 16Mhz main clock to for clocking timer4 --> it's a 'normal' PWM then and no longer high speed. Max. Prescaler is 16384 too (refer to the data sheet).

USB data were received/send via FIFO in RAM --> there's no 'register' for sending/receiving data.
Details on a USB CDC implementation can be found here http://www.atmel.com/dyn/resources/prod ... oc8447.pdf --> now you need to know how the functions were called in Arduino --> should be here https://github.com/arduino/Arduino/blob ... no/CDC.cpp

aBUGSworstnightmare
Attachments
CDC data functions
CDC data functions

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: "Arduino" Pro Micro

Post by aBUGSworstnightmare »

Hi,

bad news!

Have had no luck so far regarding the 'Leonardo' boot loader!
I've tested with Arduino Leonardo bootloader and Sparkfun disk loader but both return an Error 'Code 10: can not start device' under windows 7.

The Ardafruit AVR109 based boot loader works, but it can not be used with a 'Leonardo Target' under Arduino.

Has anybody a working boot loader/fuse bit setting for the ATmega32U4 for using it under Arduino V1.0 so far?

aBUGSworstnightmare

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

i hope the "ginue" Pro Micro works as thay show in this toturial...

i made a small board for it :) .. now i just need to wait -.-
promicroboard.jpg


regards Felix

copterrichie
Posts: 2261
Joined: Sat Feb 19, 2011 8:30 pm

Re: "Arduino" Pro Micro

Post by copterrichie »

That board really looks good and Professionally done. Looking forward to your flight testing.

User avatar
aBUGSworstnightmare
Posts: 115
Joined: Mon Jun 27, 2011 8:31 pm
Location: Munich, Germany

Re: "Arduino" Pro Micro

Post by aBUGSworstnightmare »

Hi,

finally made the Sparkfun Bootloader working (download it here (link is in the comments section at the bottom of the page): http://www.sparkfun.com/tutorials/338)! Works on Win XP; still need to confirm Win7 and OS X!!!

EDIT! OS X is not working!!! Win7 works (but device needs to be re-connected after upload; maybe this is because I'm running Win7 in a virtual machine; would be good if somebody can reconfirm!). EDIT!

Find screenshots of the fuse/lock bit settings I've used so for the beginning enclosed.

Here's a simple sketch for testing the USB/UART communication:

Code: Select all

/* Pro Micro Test Code
   by: aBUGSworstnightmare
   date: January 30, 2012
   license: Public Domain - please use this code however you'd like.
   It's provided as a learning tool.
   
   This code is provided to show how to control the Ardafruit
   ProMicro's BOOT LEDs within a sketch. It also serves
   to explain the difference between Serial.print() and
   Serial1.print().
   
   Think of the ProMicro having two separate serial ports.
   One port is for communication to and from the computer (over USB, the Serial Monitor); that's the one without the '1'.
   And the other port is a real, hardware UART; that's the one with the '1' (RX1=PD2, TX1=PD3). That's where you could talk to another Arduino,
   or any hardware device that requires serial communication.
   
   Connect your FTDI to the Leonardo as follows:
   PD2 --> TX of FTDI
   PD3 --> RX of FTDI
   GND --> GND (don't miss it!)
   Now open a terminal programm and 'listen' to the FTDI
   
   Download the sketch and open Arduiono Serial-Monitor when programm is running!
   Enjoy!

*/

void setup()
{
 pinMode(7, OUTPUT);  // Set BOOT (GREEN LED on ARDAFRUIT BREAK OUT) LED as an output

 Serial.begin(9600); //This pipes to the serial monitor
 Serial1.begin(9600); //This is the UART, pipes to sensors attached to board
}

void loop()
{
 Serial.println("Hello world");  // Print "Hello World" to the Serial Monitor
 Serial1.println("Hello!");  // Print "Hello!" over hardware UART

 digitalWrite(7, HIGH);   // set the LED on
  delay(1000);              // wait for a second
 digitalWrite(7, LOW);    // set the LED off
 delay(1000);              // wait for a second
}


.. and a screenshot of 'what you'll get'.

Time to port the code now!
aBUGSworstnightmare
Attachments
USB (serial) and UART (serial1) sketch
USB (serial) and UART (serial1) sketch
'Leonardo' Lock Bits
'Leonardo' Lock Bits
'Leonardo' Fuse Settings
'Leonardo' Fuse Settings

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

i got my promini now :D

it works with win7 x64 !

and i start testing and coding..

till now i have pin 9 & 10 working with timer 1 A & B HW PWM @488Hz
and also pin 5 & 6 with timer 4 A & D prescaled with "TCCR4B = TCCR4B & 0b11111000 | 0x8;" HW PWM @488Hz :P

thay are running at 8 bit atm .. but from datasheet thay may work with 16 or 11bit

now i need to get the usb work with the gui .. then i can check the RX input pins ..
for servos and motor 4-8 we have timer 3 A B C and timer 0 A B free.
timer 0 may be used for ampereDieter's 11bit RX input ..

i think ill upload the code tomorrow .. when i did more tests .. but i think it looks like it will work

regards Felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

I work atm on serial/usb

i trie to do it with Serial .. but it wont work :(

i want to use Serial.write(buf,head); instead of UartSendData();.. but it says:

"Serial:139: error: no matching function for call to 'Serial_::write(uint8_t [256], uint8_t&)'
C:\Users\...\Desktop\arduino\hardware\arduino\cores\arduino/USBAPI.h:38: note: candidates are: virtual size_t Serial_::write(uint8_t)"

someone knows what i do wrong?

serial read works..

[edit] i uploaded my actual code here http://code.google.com/p/multiwii/sourc ... i_promicro (use the zip file ;) ) [/edit]

regards Felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

the communication with gui now works partially .. write dosent works .. i think its because the usb code i use atm. cant read arrays ..

im on the RX code now :)

[OT]
how can i delete files form branches? the MultiWii (without .ino) and the zip file can be deleted ...
but i dont know how to do it -.-
[OT]

regards Felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

news :D

now everything except of GUI send settings to promicro seems to work :)

- conventional RX input with 6 channels works fine (tx & rx pin as aux 1 & 2)
-> attachInterrupt dosent works with 32u4 ATM. i had to do it without ..

- PPM sum should work (on tx pin)

- spectrum sattelite works with UART1

- promini to GUI over USB works now without Serial

- output for 0-8 ESC's or 0-8 Servos seems to work (ATM thay are with "just" 8bit resolution )

there is something i dont understand ... if i write something with serial monitor to the promicro, USB_Available() retuns the right length ...
but if the GUI writes the settings it always returns 1.. eaven if i do a while loop to wait -.-

is there something special how the GUI sends serial data?

regards

felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

ronco wrote:is there something special how the GUI sends serial data?


done :D

now it looks like everything works just fine ..

i will do some flight tests tomorrow (if the weather let me do it)

i added the config pde but its the same as r501 (no changes)

http://code.google.com/p/multiwii/sourc ... i_promicro

i also made a connecting image:
Connecting_ProMicro.jpg




regards

felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

again some good news :)

now i have (with help of aBUGSworstnightmare) all outputs (also for the servos) of the promicro with full system resolution (1000->2000 = 1000->2000) :D
.. the first 4 motors still works with HW PWM!

i still didnt fly it .. becaus i have to finish my copter for it first ..

@ Danal
while checking the soft PWM outputs for hexa and octo i found that the spectrum satelite code does heavy jitter to the soft pwm interrupts :(
is there a way to fix or reduce this?

regards

felix

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: "Arduino" Pro Micro

Post by ziss_dm »

Hi ronco,

I'm using this RX routine:

Code: Select all

#define SPEK_STATE_START     0x00
#define SPEK_STATE_HEADER01  0x10
#define SPEK_STATE_PAYLOAD00 0x20
#define SPEK_STATE_PAYLOAD01 0x30
void  readSpectrum(){
  static uint8_t g_state = SPEK_STATE_START;
  static uint8_t val0;
  register uint8_t state = g_state & 0xF0;
  register uint8_t cnt_  = g_state & 0x0F;
  if (SerialAvailable(1)) {
    do {
      uint8_t val1 = SerialRead(1);
      switch (state) {
        case SPEK_STATE_START: 
          val0  = val1;
          state = SPEK_STATE_HEADER01;
          break;
        case SPEK_STATE_HEADER01:
            state = SPEK_STATE_PAYLOAD00; cnt_ = 0;
            // ToDo: Read status/RSI
            #if defined(FAILSAFE)         
              if(failsafeCnt > 20) failsafeCnt -= 20; else failsafeCnt = 0;   
            #endif
          break;
        case SPEK_STATE_PAYLOAD00: 
          val0  = val1;
          state = SPEK_STATE_PAYLOAD01;
          break;
        case SPEK_STATE_PAYLOAD01: 
          state = SPEK_STATE_PAYLOAD00;
          if ((cnt_++) == 0x06) state = SPEK_STATE_START;
          uint8_t C = (val0 >> SPEK_CHAN_SHIFT) & 0x0F;
          if (C < 10)
          #if (SPEKTRUM == 1024)
            rcValue[C] = (((val0 & SPEK_CHAN_MASK)  << 8) | val1) + 988;
          #endif       
          #if (SPEKTRUM == 2048)   
            rcValue[C] = (((val0 & SPEK_CHAN_MASK)  << 8) | val1) >> 1) + 988;
          #endif     
          break;
      }
    } while (SerialAvailable(1));
  } else state = SPEK_STATE_START;
  g_state = state | cnt_;
}


It works for me. (but requires some changes in LCD configurator) ;)

Discussion is here:
viewtopic.php?f=8&t=955&start=20

regards,
ziss_dm

Danal
Posts: 137
Joined: Tue Oct 18, 2011 5:15 pm

Re: "Arduino" Pro Micro

Post by Danal »

ronco wrote:@ Danal
while checking the soft PWM outputs for hexa and octo i found that the spectrum satelite code does heavy jitter to the soft pwm interrupts :(
is there a way to fix or reduce this?

regards

felix


Yes. Better/smaller/faster interrupt handler currently in test in my branch. I will merge into shared in a few days, and you can merge those changes into your port.

Thanks for doing this... I now have a couple of pieces of hardware, and will be looking at your build very soon.

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

and thank you :)

using the satelite with a arduino micro will be nice for small copters .
Danal wrote:... and you can merge those changes into your port.


i have to say its not realy a port! its more a support.

if we have successful flight tests done, it will be esasy to merge this code into actual MWC!
nothing of this code will interfere with promini or mega code...

regards

felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

... i finished my copter today and did a lot of flight tests with it :D

hardware:
- FC = Promicro
- Gyro = ginue WMP
- ACC = BMA020
- ESC's = 4 Dymond Smart 10 (similar to turnergy Plush) with sil-F334 chip (ginue software)
- Motors = 4x Scorpio S2208 (with 8x3,8 APC)
- RX = Spectrum DX6
- Lipo = 3s 3200mAh
- motor to motor diameter (X) = ~37cm (its asynchronous)

first test - does it fly?:
- it does :)

second test - cross test promicro vs. promini..
setup:
- same copter
- same sensors
- same reciver
- same WMC ver.

results:
- both fly well ;)
- max P on promini = 3,5 (I and D are default)
- max P on promicro = 8 ! (I and D are default)
- promicro feels like twice stable as with promini (i think thats because of more then twice P)

so i think the high res PWM rocks !



regards

felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

to may motivate some people to trie something new, i made a promini vs promicro compersion table ;)
ProminiVSPromicro.jpg

to have a clear look at the differences .. this table shows how it is now.. in future with other breakout boards (with all pins broken out) or complete FC's with the ATmega32_u4 :P, there will be more features like 6 HW PWM and no dubble pin usage for RXO and TXO available.

regards

Felix

timecop
Posts: 1880
Joined: Fri Sep 02, 2011 4:48 pm

Re: "Arduino" Pro Micro

Post by timecop »

If you're redoing the new multiwii "reference platform" 2 years after it was created, and the only worthwhile upgrade is adding 0.5K of ram, you better look elsewhere.

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hey dongs .. i dont know your problem ... i dont redo anything ...
all changes on the MWC code to support the atmega32u4 are done with a few simple defines!
it is supported by Arduino so the difference to use it is just like it is with promini and mega.

and yes.. its not the revolution of multiwii but it has some advantages compered to the atmega328p .. why should we not use it?

regards felix

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

Re: "Arduino" Pro Micro

Post by Alexinparis »

ronco wrote:... i finished my copter today and did a lot of flight tests with it :D

hardware:
- FC = Promicro
- Gyro = ginue WMP
- ACC = BMA020
- ESC's = 4 Dymond Smart 10 (similar to turnergy Plush) with sil-F334 chip (ginue software)
- Motors = 4x Scorpio S2208 (with 8x3,8 APC)
- RX = Spectrum DX6
- Lipo = 3s 3200mAh
- motor to motor diameter (X) = ~37cm (its asynchronous)

first test - does it fly?:
- it does :)

second test - cross test promicro vs. promini..
setup:
- same copter
- same sensors
- same reciver
- same WMC ver.

results:
- both fly well ;)
- max P on promini = 3,5 (I and D are default)
- max P on promicro = 8 ! (I and D are default)
- promicro feels like twice stable as with promini (i think thats because of more then twice P)

so i think the high res PWM rocks !



regards

felix


Hi,
It's interresting to see that a 16 bit hardware PWM allows higher PIDs than a 8 bit hardware PWM.
It's not possible for the PROMINI (or maybe just for Timer1) , but there maybe also some inmprovement possibilities for PMW on MEGA.
(I noticed a remaining error in your code about the servo mapping for bicopter)

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Alexinparis wrote:Hi,
It's interresting to see that a 16 bit hardware PWM allows higher PIDs than a 8 bit hardware PWM.
It's not possible for the PROMINI (or maybe just for Timer1) , but there maybe also some inmprovement possibilities for PMW on MEGA.
(I noticed a remaining error in your code about the servo mapping for bicopter)


hi Alex,

ampereDieter did this improvements for mega with his mod .. but he did it in a "hardcore coder" way :P
i talked to him and there are some people testing his mod .. i think we may get some results soon.

i told him that it may be better to show an implemention that is not that complex. so there is a softer way to implement it without changing everything and with understandable code.

and .. can you show me where this bicopter servo code error is? i dont see it :(

regards

felix

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: "Arduino" Pro Micro

Post by ziss_dm »

Hi ronco,

As I can see only 2 channels are true hw PWM, the rest is interrupts. Am I missing something or why is that?

regards,
ziss_dm

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi ziss,

do you mean in ampereDieters mod or in my promicro code?

in promicro code:
Timer 1 A & B and Timer 4 A & D is used as real hardware PWM.

Code: Select all

 // to write values > 255 to timer 4 A we need to split the bytes
      static uint8_t pwm4_HBA; // high byte for timer 4 A
      static uint16_t pwm4_LBA; // low byte for timer 4 A
     
      pwm4_LBA = 2047-motor[2]; // channel A is inverted
      pwm4_HBA = 0;
     
      while(pwm4_LBA > 255){
        pwm4_HBA++;
        pwm4_LBA-=256;
      }
     
      TC4H  = pwm4_HBA; // high byte
      OCR4A = pwm4_LBA;  //  pin 5


if you mean that thing with TC4H ... its to set the high byte... because the timer is 11bit but the OCR register is just 8..
so it is a way to write to the OCR's nothing more .. the "real" 16bit register does the same but they do it automaticly.
from datasheet:
Tim4 EH PWM.jpg


[edit]
maybe that helps
Promicro_pin_usage.jpg

[/edit]


regards

felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

@ ziss_dm

i have a question.. you said thet soft pwm on promini works with 0,8 us Jitter..
is this because 2000 / 255 stepes = 7,84 ? means jitter is around 1step?

if it is like this. it may be also better with a 16bit timer ...
2000 / 16000 steps = 0,125 ... = 0,0125 us Jitter?

regards

felix

ziss_dm
Posts: 529
Joined: Tue Mar 08, 2011 5:26 am

Re: "Arduino" Pro Micro

Post by ziss_dm »

Hi ronco,

I would say ~10us.

Image

This is due other interrupt handlers in the system.

regards,
ziss_dm

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

i did this test http://www.youtube.com/watch?v=n_g2s1nc ... rofilepage

that ziss_dm did with his new ESC firmware now with the promicro and ginue ESC's.

http://www.youtube.com/watch?v=hiqGf4M_ ... e=youtu.be

i think the results looks similar :)


regards

Felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

with the permission of alex i have merged the promicro code now to shared :)

regards

Felix

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »

Hi,

there is a new version of the promicro out now.. thay fixed the tx rx LED bug and the misslabeled pin.
also the power handling is better now :)
micros.jpg


regrads

felix

amourdurisk
Posts: 31
Joined: Wed Nov 02, 2011 8:58 pm

Re: "Arduino" Pro Micro

Post by amourdurisk »

Nice job ;p

in the multiwii source, i can't read the file "connecting promicro.jpg" an idea ?

Matt.

ronco
Posts: 317
Joined: Thu Aug 18, 2011 2:58 pm

Re: "Arduino" Pro Micro

Post by ronco »


tdriedger
Posts: 2
Joined: Fri Mar 16, 2012 12:52 am

Re: "Arduino" Pro Micro

Post by tdriedger »

Hey folks,

I don't want to hijack this thread but it seems like the best place to ask my question.

I've got an Arduino Pro Micro that I'm using on a project. I'd like to be able to read in data from an RC receiver. Being an Arduino newb, I have not completely wrapped my head around the PCINT functionality that is being used in the MultiWii code.

Could one of you code wizards send me a simple sketch that lets me read 6 (or more) channels (from individual pins) into variables that get printed out to the serial monitor?

Thanks for your help,

Tim

Post Reply