Author Topic: Beginner: Interpreting MCU datasheet: Atmega1284  (Read 2937 times)

0 Members and 1 Guest are viewing this topic.

Offline obiwanjacobiTopic starter

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Beginner: Interpreting MCU datasheet: Atmega1284
« on: May 05, 2015, 10:36:04 am »
Hi,

I am trying to descent onto MCU level with my understanding coming from an Arduino Uno. I have scored two Atmega1280 MCUs for a hobby project (MIDI related) and want to start using Atmel Studio as an IDE. This means there are a lot of new things to learn and do.

While reading through the atmega1284 datasheet I was strugling to understand the "Overriding Signals for Alternate Functions" tables for the ports. For instance table 14-4 and 14-5 on pages 79 and 80 for Port-A.

How should these tables be interpreted?

Thanx!

« Last Edit: May 05, 2015, 11:38:09 am by obiwanjacobi »
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline obiwanjacobiTopic starter

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #1 on: May 05, 2015, 01:18:40 pm »
So it's more an explanation of what will happen if you turn on say the USART0 and how it will take control of the pin...

Still not quite clear on the exact meaning of the content of each cell, but if I understand correctly this is not something I need when picking features (deciding what pin to use for what function) and programming it later on...

Thanx.
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4288
  • Country: us
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #2 on: May 07, 2015, 11:33:41 pm »
Quote
this is not something I need when picking features (deciding what pin to use for what function) and programming it later on.
The table you reference seems to be describing the internal operation of the chip.
As a user, you probably would look at the "Alternate Functions of Port A" table instead; you need to know that if you use a certain function, that will make other functions unavailable (and the exact electrical implicates are less important.  Usually.)

In general on AVR chips, you don't get to 'decide' "what pin to use for what function"; at least for hardware functions (uart, SPI, I2C, PWM, etc.)
So you get to notice things like "if I want to use all 8 PWM outputs, I only have one 8bit GPIO port left..."
 

Offline obiwanjacobiTopic starter

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #3 on: May 08, 2015, 05:14:26 am »
Got it, thanks.

I am laying down the schematic, so with 'decide' I meant "to what pin should I connect this to make full use of the hardware capabilities of the MCU". For instance I connected my MIDI-in to the RX of the USART(0).
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #4 on: May 08, 2015, 06:08:32 am »
In Arduino-land, there is a file (pins_arduino.h) in --

\Program Files\Arduino\hardware\arduino\variants -or-
\Program Files (x86)\Arduino\hardware\arduino\avr\variants

Which maps the available functions to hardware pins (so the Arduino compiler/linker knows how to allocate hardware resources).
The contents are logical - but a bit complex the first time around.
Use a project  that compiles & works, then examine the pins file, and it will start to make sense.
Don't ask a question if you aren't willing to listen to the answer.
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #5 on: May 08, 2015, 06:11:33 am »
... For instance I connected my MIDI-in to the RX of the USART(0).
The MIDI pin assignments will be in your {midi}.h file or somewhere in the MIDI code declarations.
They may refer to a logical port (UART0), or a specific pin - depending on the MIDI library you are using.
Don't ask a question if you aren't willing to listen to the answer.
 

Offline obiwanjacobiTopic starter

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #6 on: May 08, 2015, 06:13:07 am »
Thanks! I was just wondering about that yesterday.

<OT>
I have my Arduino Template Library I want to expand to also become a Atmel Template Library and was wondering how I should represent each device's capabilities in the code. Although I don't like MACROs so much, I would much prefer a well defined API. On the other hand people should be ably to easily correlate the code API to the datasheet terms (register names for instance).
</OT>
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 

Offline obiwanjacobiTopic starter

  • Super Contributor
  • ***
  • Posts: 1013
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
    • Marctronix Blog
Re: Beginner: Interpreting MCU datasheet: Atmega1284
« Reply #7 on: May 08, 2015, 06:14:17 am »
... For instance I connected my MIDI-in to the RX of the USART(0).
The MIDI pin assignments will be in your {midi}.h file or somewhere in the MIDI code declarations.
They may refer to a logical port (UART0), or a specific pin - depending on the MIDI library you are using.

Nah, I don't just those Arduino libraries. They are fine for rapid prototyping, but totally suck for a real project. I got my own (see signature)!  O0
Arduino Template Library | Zalt Z80 Computer
Wrong code should not compile!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf