atmega32u4 pre assigned pins

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Need some help in an area I'm struggling with.

 

 

I'm going to be using the atmega32u4 for my next project and I need to make sure I map out all the pins I will need and not use them for simultaneous operations. 

 

SPI - locked to PORTB pins. 1,2,3

USART - I think D2 and D3

USB LUFA - has its own d- d+ pins on the chip.

twi - Unsure, can not tell if it's specific pins/ports or not?

 

That is what I know/don't know at the moment. Also c6, c7, those have any specific uses, or just general I/O. I see they are output for pulse width modulation but any pin can do that with in reason and is the input capture feature any better then using a normal interrupt IRQ?

 

 

 

 

 

Last Edited: Mon. Jul 8, 2019 - 06:03 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

TWI pins are called SCL and SDA. You should be able to see them on the pinout diagram.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ah, very good, PD0 and PD1

Last Edited: Mon. Jul 8, 2019 - 06:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S_K_U_N_X wrote:
and is the input capture feature any better then using a normal interrupt IRQ?

Yes!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Where in the data sheet do I look for the time resolution? I might use this as an aux input of sorts, looks interesting.

Last Edited: Mon. Jul 8, 2019 - 09:20 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

S_K_U_N_X wrote:
the time resolution?

f/1 to f/1024 typically, look at the timer prescalar, on the 16 bit timer(s). 

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I like to start a project header with something like this:

/************ Pin assignments ATtiny4/5/9/10 *******************************************************************************************

SOT │ UDFN │ BIT │ PINCHA │ INT  │ ADC  │ AC   │ TIM0        │ TPI   │ OTHER ││ PERIF │ PERIF │ PERIF ││ NOTES
────┼──────┼─────┼────────┼──────┼──────┼──────┼─────────────┼───────┼───────┼┼───────┼───────┼───────┼┼──────────────────────────
  1 │    5 │ PB0 │ PCINT0 │      │ ADC0 │ AIN0 │ OC0A        │ DATA  │       ││       │       │       ││
  2 │    4 │     │        │      │      │      │             │       │ GND   ││       │       │       ││
  3 │    1 │ PB1 │ PCINT1 │      │ ADC1 │ AIN1 │ OC0B │ ICP0 │ CLK   │ CLKI  ││       │       │       ││
  4 │    8 │ PB2 │ PCINT2 │ INT0 │ ADC2 │      │ T0          │       │ CLKO  ││       │       │       ││
  5 │    7 │     │        │      │      │      │             │       │ VCC   ││       │       │       ││
  6 │    6 │ PB3 │ PCINT3 │      │ ADC3 │      │             │       │ RESET ││       │       │       ││
  
***************************************************************************************************************************************/

 

... or this:

/************ Pin assignments ATmega328P and friends *****************************************************************************

ARDUINO │ DIP │ QFP │ BIT │ PIN CHA │ INT  │ COMM │ ANALG │ TIMER │ TCLOK │ CLOCK ││ PERIF │ PERIF │ PERIF ││ NOTES
────────┼─────┼─────┼─────┼─────────┼──────┼──────┼───────┼───────┼───────┼───────┼┼───────┼───────┼───────┼┼─────────────────────
00      │  02 │  30 │ PD0 │ PCINT16 │      │ RXD  │       │       │       │       ││       │       │       ││
01      │  03 │  31 │ PD1 │ PCINT17 │      │ TXD  │       │       │       │       ││       │       │       ││
02      │  04 │  32 │ PD2 │ PCINT18 │ INT0 │      │       │       │       │       ││       │       │       ││
03      │  05 │  01 │ PD3 │ PCINT19 │ INT1 │      │       │ OC2B  │       │       ││       │       │       ││
04      │  06 │  02 │ PD4 │ PCINT20 │      │ XCK  │       │       │ T0    │       ││       │       │       ││
05      │  11 │  09 │ PD5 │ PCINT21 │      │      │       │ OC0B  │ T1    │       ││       │       │       ││
06      │  12 │  10 │ PD6 │ PCINT22 │      │      │ AIN0  │ OC0A  │       │       ││       │       │       ││
07      │  13 │  11 │ PD7 │ PCINT23 │      │      │ AIN1  │       │       │       ││       │       │       ││
08      │  14 │  12 │ PB0 │ PCINT0  │      │      │       │ ICP1  │       │ CLKO  ││       │       │       ││
09      │  15 │  13 │ PB1 │ PCINT1  │      │      │       │ OC1A  │       │       ││       │       │       ││
10      │  16 │  14 │ PB2 │ PCINT2  │      │ SS   │       │ OC1B  │       │       ││       │       │       ││
11      │  17 │  15 │ PB3 │ PCINT3  │      │ MOSI │       │ OC2A  │       │       ││       │       │       ││
12      │  18 │  16 │ PB4 │ PCINT4  │      │ MISO │       │       │       │       ││       │       │       ││
13      │  19 │  17 │ PB5 │ PCINT5  │      │ SCK  │       │       │       │       ││       │       │       ││
        │  09 │  07 │ PB6 │ PCINT6  │      │      │       │       │ TOSC1 │ XTAL1 ││       │       │       ││
        │  10 │  08 │ PB7 │ PCINT7  │      │      │       │       │ TOSC2 │ XTAL2 ││       │       │       ││
14 + A0 │  23 │  23 │ PC0 │ PCINT8  │      │      │ ADC0  │       │       │       ││       │       │       ││
15 + A1 │  24 │  24 │ PC1 │ PCINT9  │      │      │ ADC1  │       │       │       ││       │       │       ││
16 + A2 │  25 │  25 │ PC2 │ PCINT10 │      │      │ ADC2  │       │       │       ││       │       │       ││
17 + A3 │  26 │  26 │ PC3 │ PCINT11 │      │      │ ADC3  │       │       │       ││       │       │       ││
18 + A4 │  27 │  27 │ PC4 │ PCINT12 │      │ SDA  │ ADC4  │       │       │       ││       │       │       ││
19 + A5 │  28 │  28 │ PC5 │ PCINT13 │      │ SCL  │ ADC5  │       │       │       ││       │       │       ││
        │  01 │  29 │ PC6 │ PCINT14 │      │      │       │       │       │ RESET ││       │       │       ││
20   A6 │     │  19 │     │         │      │      │ ADC6  │       │       │       ││       │       │       ││
21   A7 │     │  22 │     │         │      │      │ ADC7  │       │       │       ││       │       │       ││

*********************************************************************************************************************************/

 

... or:

/************ Pin assignments ATtiny25/45/85 *******************************************************************************************

DIP / QFN / BIT / PINCHA / INT  / ADC  / AC   / TIM0  / TIM1  / 2WIRE / 3WIRE / ICSP  / OTHER      || PERIF | PERIF | PERIF || NOTES
----/-----/ ----/--------/------/------/----- /-------/-------/-------/-------/-------/------------||-------|-------|-------||----------
  1 /   1 / PB5 / PCINT5 /      / ADC0 /      /       /       /       /       /       / RESET/dW   ||       |       |       ||
  2 /   2 / PB3 / PCINT3 /      / ADC3 /      /       / _OC1B /       /       /       / XTAL1/CLKI ||       |       |       ||
  3 /   5 / PB4 / PCINT4 /      / ADC2 /      /       /  OC1B /       /       /       / XTAL2/CLKO ||       |       |       ||
  4 /   8 /     /        /      /      /      /       /       /       /       /       / GND        ||       |       |       ||
  5 /  11 / PB0 / PCINT0 /      / AREF / AIN0 /  OC0A / _OC1A / SDA   / DI    / MOSI  /            ||       |       |       ||
  6 /  12 / PB1 / PCINT1 /      /      / AIN1 /  OC0B /  OC1A /       / DO    / MISO  /            ||       |       |       ||
  7 /  14 / PB2 / PCINT2 / INT0 / ADC1 /      /  T0   /       / SCL   / USCK  / SCK   /            ||       |       |       ||
  8 /  15 /     /        /      /      /      /       /       /       /       /       / VCC        ||       |       |       ||

***************************************************************************************************************************************/

 

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"Wisdom is always wont to arrive late, and to be a little approximate on first possession."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I like to start a project header with something like this:

That's a good way to maintain sanity!  No forging around digging up the datasheet.  Sadly, many newer AVR's let you scramble the pin assignments---adds a layer of ??? when your signal does not appear  at the pin 

When in the dark remember-the future looks brighter than ever.   I look forward to being able to predict the future!