Showing posts with label arduino. Show all posts
Showing posts with label arduino. Show all posts

Sunday, February 21, 2016

Arduino 828p Pro Mini

I bought this small board Arduino Mini (the right board, not the left board which is just a power regulator) from eBay from China for less than $2 plus S/H.  The bareboard has SMD version of Atmel AVR 828p, a RESET switch (left), and bunch of I/O ports.  The board seems a clone of what Sparkfun has (see https://www.sparkfun.com/products/11113)

Specifications:
  • 20 Digital input / output ports:TX, RX, D2..D13, A0 .. A5
  • 8 analog inputs ports:A0 ~ A7
  • 1 pairs of TTL level serial transceiver ports RX / TX
  • 6 PWM ports: D3, D5, D6, D9, D10, D11
  • Main Chip: Atmel Atmega328P-AU
  • Support Serial Download
  • Support external power supply 3.8-12V DC
  • Support 12V or less than 12V battery power supply
  • 16MHz clock frequency
  • Size: 33.8mm x 18mm
  • Supports auto-reset
  • Max 150mA output
  • Over current protected
  • Weighs less than 2 grams

When supplying unregulated power to the board, we should connect to the “RAW” pin and not VCC.
I/O pins are labeled "D0", "D1", ... "D13" for digital I/Os, and "A0" to "A7" for analog inputs.  There are two TRO and RXI pins.


Label on BoardFunction(s)
A0ADC0
A1ADC1
A2ADC2
A3ADC3
A4ADC4/SDA
A5ADC5/SCL
A6ADC6
A7ADC7
RXID0/RXD
TXOD1/TXD
D2D2/INT0
D3D3/INT1
D4D4/T0
D5D5
D6D6/OC0B
D7D7/IN1
D8D8/ICP1
D9D9/PCINT1
D10D10/PCINT2
D11D11/PCINT3
D12D12/MISO
D13D13/SCK/LED

Wednesday, June 19, 2013

SPI on Arduino Nano v3.0

IC Package: 32 pin MLF



Arduino
Pin #
ATMEL 328P
 (MLF) pin#
ATMEL 328P
(PDIP) pin#
Label Function
D10 14 16 PB2 SS*
D11 15 17 PB3 MOSI
D12 16 18 PB4 MISO
D13 17 19 PB5 SCK


The problem is, according to Arduino Nano schematic, pin 13 is connected to LED through 330 ohm resistor in series.
To be able to use SPI correctly, we need to disconnect the LED.

Tuesday, June 18, 2013

Arduino Nano v3.0 with avr-dude



My order of two Arduino Nano-compatible v3.0 from eBay (shipped from China) just arrived. Also bought the USBASP USBISP AVR Programmer from eBay (about $3.0, from China too, see the picture on the left).


The good thing about this USBISP AVR programmer, besides the unbelievable price, I was told that it is  also compatible with avrdude, even Atmel AVR Studio (never tried it, thought)

But when I tried to program it with avr-dude, it always failed with various errors, such as:






avrdude: ser_recv(): programmer is not responding
avrdude: stk500v2_ReceiveMessage(): timeout

avrdude: stk500v2_getsync(): timeout communicating with programmer
or:
...
         Using Port                    : /dev/ttyUSB2
         Using Programmer              : avrisp
         Overriding Baud Rate          : 57600
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding
...



I tried "-c arduino" without setting the baud-rate, I also tried different programmer type (stk500v2, etc.), nothing worked.  Turned out, the parameters combination I used was wrong.
In this case, the programmer should be "arduino" but the baudrate must be set to something (in this case, 57600).

The following is the correct one:


bash-4.2$ avrdude -c arduino -b 57600 -P /dev/ttyUSB2 -p atmega328p -vv -U flash:w:blink.hex

avrdude: Version 5.11, compiled on Sep  9 2011 at 16:00:41
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/home/mlutfi/.avrduderc"

         Using Port                    : /dev/ttyUSB2
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "blink.hex"
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: writing flash (1468 bytes):

Writing | ################################################## | 100% 0.41s

avrdude: 1468 bytes of flash written
avrdude: verifying flash memory against blink.hex:
avrdude: load data flash data from input file blink.hex:
avrdude: input file blink.hex auto detected as Intel Hex
avrdude: input file blink.hex contains 1468 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.30s

avrdude: verifying ...
avrdude: 1468 bytes of flash verified

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.