Arduino Leonardo hardware I/O

Let Sim Innovations know about your Air Manager experience and let us know about your dream feature addition

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Arduino Leonardo hardware I/O

#1 Post by jph »

Hi all
Just out of interest,
Looking at the hardware pin capability in the - https://siminnovations.com/wiki/index.p ... re_id_list
For the Leonardo - I just wondered why the possibility of 12 ADC and 7 PWM (hardware) are not possible in AM ? - not all at the same time obviously.... :) - the board appears capable of such.
Joe. CISSP, MSc.

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino Leonardo hardware I/O

#2 Post by Corjan »

Hi,

From what I remember, the atmega32u4 has two available timers with 3 channels each. But only 4 pins out of those are mapped to the pins on the board.
Not sure about the analogue stuff, but there is probably a reason why it only has A0 through A5.

Corjan

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Arduino Leonardo hardware I/O

#3 Post by jph »

Corjan wrote: Fri Apr 16, 2021 5:03 pm Hi,

From what I remember, the atmega32u4 has two available timers with 3 channels each. But only 4 pins out of those are mapped to the pins on the board.
Not sure about the analogue stuff, but there is probably a reason why it only has A0 through A5.

Corjan
Hi @Corjan
Interesting.
The ADC Multiplexor on the micro does seem to be a single 12 way MUX allowing 12 independent and simultaneous ADC inputs.
Analog Inputs: A0-A5, A6 - A11 on digital pins 4, 6, 8, 9, 10, and 12
That would be very useful to have.
The PWM, I must admit I am struggling to get my head around the complexity of the timers from the datasheet and have no idea what else you may be using some for :)
It would appear that the 7 PWM outputs are available from Arduino IDE, but I believe your code is custom ?
Joe
Joe. CISSP, MSc.

User avatar
Corjan
Posts: 2933
Joined: Thu Nov 19, 2015 9:04 am

Re: Arduino Leonardo hardware I/O

#4 Post by Corjan »

Hi,


Basically, you can use 1 timer to drive 3 PWM channels.
The uc has 3 available timers, of which 1 is used for the LED's, and two are available for PWM. Of those two, 1 are mapped to 3 pins, the other to 1 pin.

The analog pins could indeed probably be expanded, but I'd rather just keep using the Ax pins, just like all other Arduino's.


Corjan

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Arduino Leonardo hardware I/O

#5 Post by jph »

Corjan wrote: Sat Apr 17, 2021 7:54 am Hi,


Basically, you can use 1 timer to drive 3 PWM channels.
The uc has 3 available timers, of which 1 is used for the LED's, and two are available for PWM. Of those two, 1 are mapped to 3 pins, the other to 1 pin.

The analog pins could indeed probably be expanded, but I'd rather just keep using the Ax pins, just like all other Arduino's.


Corjan
Hi Corjan, Understood. I can fully appreciate why you would want to maintain standardisation across the various units. The Leonardo is a lovely unit and would offer it's flexibility for ADC inputs in Messageport, or indeed, as a HID controller, most likely combining both the HID and 12 ADC inputs.
I also note you have added the rx/tx serial pins D0 and D1 as I/O now for the 32U4, much appreciated. (an the same for the pro-micro or any 32U4), nice one.
Out of interest, - for the LED function ?, it would be logical to presume from your post (well logical for me haha) :D ) that the LED function is also using PWM. Is this simply a case of selective use of the PWM resolution abilities of the various timers or a software pwm solution for LED ?
Joe
Joe. CISSP, MSc.

Post Reply