Beginner: Interpreting MCU datasheet: Atmega1284 - Page 1
Forum section: electronics / general

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 05, 2015, 10:36:04 am
content: 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 theatmega1284 datasheetI 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!

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 05, 2015, 01:18:40 pm
content: 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.

author: westfw
author_rank: Super Contributor
timestamp: May 07, 2015, 11:33:41 pm
content: QuoteThe 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..."

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 08, 2015, 05:14:26 am
content: 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).

author: SL4P
author_rank: Super Contributor
timestamp: May 08, 2015, 06:08:32 am
content: 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\variantsWhichmaps 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.

author: SL4P
author_rank: Super Contributor
timestamp: May 08, 2015, 06:11:33 am
content: Quote from: obiwanjacobi on May 08, 2015, 05:14:26 amThe 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.

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 08, 2015, 06:13:07 am
content: 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>

author: obiwanjacobi
author_rank: Super Contributor
timestamp: May 08, 2015, 06:14:17 am
content: Quote from: SL4P on May 08, 2015, 06:11:33 amNah, 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