Embedded System - Arduino

 

 

 

 

Basic Information

 

As you are getting deeper and deeper in your programming in Arduino after trying some of the ready made examples and doing some of your own simple project like Sensor basic, Motor Basic, you will refer to information on this page more frequently.

 

 

Board Outlook

 

 

 

Atmema 328 Pin / Arduino Pin 

 

 

 

 

Atmema 328 Pin / Arduino Pin / Register Memory Map

 

 

 

 

 

Atmega 328 GPIO Memory Map/ Register Description

 

 

 

 

 

 

 

 

Atmega 328 USART Memory Map/ Register Description

 

Following is overall Memory Map for USART Registers. For the detailed usage of each of these registers, refer to Minimal C programming for Tx Only Serial Communication

 

 

 

Atmega 328 I2C Memory Map/ Register Description

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Location of Compiler / Upload tool

 

It seems that the location of the c compiler and upload tool is different depending on the operating system and Arduino IDE version. So don't trust this information too much and find it on your PC by yourself. You can search "avr-gcc" on Windows file explorer or "ls -al -R | grep "avr-gcc"" on linux. In my case, I am using Arduino IDC 1.6.7 on Windows 7. These tools are located in

    C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\

Theoretically, you can compile and upload it to the board by running a sequence of commands as below ( Note : Blink.c is the source code file name.)

 

"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc" -Os -DF_CPU=16000000UL -mmcu=atmega328p -c -o Blink.o Blink.c

"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-gcc" -mmcu=atmega328p Blink.o -o Blink

"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-objcopy" -O ihex -R .eeprom Blink Blink.hex

"C:\RyuCloud\Arduino\C\Blink>"C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avrdude" -C "C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -F -V -c arduino -p ATMEGA328P -P COM3 -b 115200 -U flash:w:Blink.hex

 

 

Location of  *.h and *.c files that make Arduino work

 

It seems that the location of these files are different depending on the operating system and Arduino IDE version. So don't trust this information too much and find it on your PC by yourself. You can use some of following file name as a keywork for searching. In my case, I am using Arduino IDC 1.6.7 on Windows 7. These tools are located in

    C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr

Followings are some of the files you would often refer to

  • sfr_defs.h  <== Various functions and Macros that are used in other header files
  • iom328p.h <== Various defines for the specific chipset (like PIN name, Bit position for Pins etc). This is for Arduino Uni chipset. You can find a lot of other chipset header files.

 

 

Location of Arduino API Source Code

 

It seems that the location of these files are different depending on the operating system and Arduino IDE version. So don't trust this information too much and find it on your PC by yourself. You can use some of following file name as a keywork for searching. In my case, I am using Arduino IDC 1.6.7 on Windows 7. These tools are located in

    C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino

 

 

Tips to find tools and parameters to build Arduino source code

 

The location of these tools (e.g, compiler, .hex generator, uploading to board etc) would very with your Arduino IDE installation location, version or operating system. So the information from many of the tutorials on the web may not work if you just blindly copy those command. One easy way to find these information for your current Arduino setp is to build Arduino sketch in verbose mode and then look into these information from print-out at the bottom of the Arduino IDE.

 

 

Reference :

 

[1] ATMEGA328 datasheet

[2] Arduino Uno Rev3-schematic

[3] Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete

[4] Playing with Arduino

[5] How to Choose your ARM Cortex-M Processor (YouTube)