User Tools

Site Tools


dig:uc2

Microcontroller resources

The class uses an Atmel AVR microcontroller from Atmel, specifically, the ATmega type controller ATmega328P, mounted on a small open-source development board called Arduino Nano board developed by Gravitech and supported by Arduino. It can be bougth in Amazon at really good prices.

The Arduino Nano board

The Atmel mega chips are 8-bit RISC procesor optimized for small code size that allow up 2KB bootloader to avoid the use of specific programmers. The ATmega328 has 32KB flash, 2KB SRAM, 1KB EEPROM. It can work in a range of CPU clock frequencies, which maximum depends on the power supply (4-20MHz). It has other features like GPIOs, ADC, Timers (for PWM), USART, SPI and TWI(I2C).

It is supported by Arduino, so you can simplify your designs using C-Sketch programming style, under the Arduino software tool, that is multiplatform (developed with JAVA). By downloading to its Flash memory a specific bootloader, you can reprogram the code through its UART, that is connected to a FTDI chip to your laptop USB port.

Programming style is completely based on available libraries that reduces development time considerably. Many examples are included in the development tool and there are plenty of available examples on internet.

Tool installation

Development tool can be downloaded directly from Arduino web site. We recommend to download and install the latest stable version (1.6.0 in 2015)

For a proper installation and first connection, you can follow these recommendations

USB interface of Arduino Nano board uses a dedicated USB to UART chip from FTDI or a Chinese clone CH340G, so FTDI drivers pr CH340 drivers must be installed in those operating systems where it is not automatically recognized.

Note that the Nano boards distributed in 2015 do NOT use an FTDI chip. Instead, the default Windows driver search should be used to find the proper driver. The whole driver installation process is cryptic, so don't hesitate to ask for help.

Starting a new project

Once you open the software development tool a new project is ready or programming. Sketch programming style is based on C-language but it simplifies it to the maximum.

The only mandatory two functions that must have your code are: * void setup(void) {} : is called once after the reset. * void loop(void) {} : its content is executed iteratively until the power is switch off or a reset signal is received. No headers declarations are needed.

You can open available examples from the File menu of the development tool. A good starting point could be Blink example of Basic category.

The button on the left verifies the source code, the next button (with an arrow pointing to right) compiles and download the code to the Arduino through the USB cable. This second button is enough for working. But before pressing that button you must select the proper serial port (check on Windows Device Manager), proper board (Arduino Nano w/ ATmega328) and programmer (AVRISP) from Tools menu.

The remaining three buttons allows you to create a new project, to open an existing one or to save current project.

Make ATmega328P board compatible with Arduino Sketches

If you solder your own Arduino Nano board, you have to know that ATmega328P come with any boot loader when bought separately. Therefore, after you finish the hard work of soldering you Arduino board (specially for Array Resistors), you need to proceed to flash the boot loader.

This boot loader flashing can be done by yourself using your commercial Arduino Nano board as an ISP programmer. In this link you can see all the steps for success.

Documentation

For Arduino Nano with CH340 USB serial interface chip

Windows

Linux

dig/uc2.txt · Last modified: 2024/02/29 07:28 by 127.0.0.1