If there is an Arduino MEGA, then there should be a MEGAshield

March 16th, 2009

Hi, I just saw the picture of the Arduino MEGA featured in hack-a-day

If there is an Arduino MEGA, then for sure you need a MEGAshield. Here are some pictures of the NKC MEGAShield:

MEGAshield PCB

MEGAshield 1

MEGAshield 2

MEGAshield 3

MEGAshield 4

Half Stackable MEGAShield = Monster MEGAShield (As called by ladyada)

I installed long legged 6-pin and 8-pin headers to make the Arduino MEGAshield stackable on the left half side (legacy Arduino side?). Here are some pictures:

MEGAshield 5

MEGAshield 6

MEGAshield 7

MEGAshield 8

Assembling the NKC Electronics XBee Shield V3.0 KIT

March 12th, 2009

Assembling the NKC Electronics XBee Shield V3.0 KIT

A new version of this kit is available as V4

SCHEMATICS (click on images to enlarge)
xbee shield v3.0 schematics

The NKC Electronics XBee Shield V3.0 KIT is an enhanced version of the original Arduino XBee Shield. It is sold in a DIY kit format and it comes with all the components required to assemble a full XBee Shield that is pin-compatible with all Arduino format compliant boards (Arduino, Freeduino, Seeeduino, etc).
First, unpack the kit

Xbee Shield V3.0 KIT

and start with the PCB.

Let’s start with the power portion of the schematic using the following parts:

IC1 TLV2217-33 Voltage Regulator (TO-220 package)
C1 100nF ceramic capacitor
C2, C3 10uF electrolytic capacitor

xbee shield v3.0 KIT

Next continue with the transistor, LEDs and other discrete components:

xbee shield v3.0 KIT

R1 10K resistor
R2 15K resistor
R3, R4 1K resistor
R5 330ohm resistor
RSSI 3mm LED
ASSOCIATE 3mm LED blue (transparent)
T1 BC547 transistor
reset tactile switch

Solder the sockets and pin headers:

xbee shield v3.0 KIT

Next step: Insert the jumpers:

xbee shield v3.0 KIT

There are 4 jumpers. J1 and J2 are for upgrading the firmware on the XBee module. Leave open for normal operation (both J1 and J2 open).

xbee shield v3.0 KIT

Pay special attention to the alignment of the female headers. The 2×3 female socket must be placed with the female portion facing down. This board takes some signals from the ICSP connector, so this socket is mandatory.

And this is the final picture of the XBee Shield V3.0 assembled and ready to use. XBee module is not included in the kit and must be purchased separately.

xbee shield v3.0 KIT

http://www.nkcelectronics.com/

atxmega128a1 DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc – 0.6V

March 12th, 2009

I started experimenting with the new ATMEL atxmega128a1 chip, when I noticed a strange noise in the signal generated by the DAC example (atmel application note AVR1301: Using the XMEGA DAC). I captured the signal with a Rigol VS5042 Digital Storage Oscilloscope:

XMEGA DAC problem

You can clearly see the noise at the bottom of the sawtooth signal.

The setup:

  • STK600 (Target Voltage 3.6V)
  • TQFP100 Package
  • ATMEGA128A1
  • AVR Studio 4.15
  • WINAVR 20080610
  • Rigol VS5042 Digital Storage Oscilloscope
  • AVR1301 example in C

I thought there was a mistake in the example program, and was about to review it, when I found the following note in the Errata section of the atmega128a1 preliminary datasheet:

“DAC is nonlinear and inaccurate when reference is above 2.4V or Vcc – 0.6V”

So I went back to AVR Studio and set the target voltage of the STK500 (and the target device) to 2.0V, and the problem does not appear:

DAC solved

I assume the VREF used by the example program is internal, so lowering the voltage of the target device is the setup that fixes the problem. I will change the example program to use external VREF and see if it is possible to power the target with 3.3V and lower VREF to 2.0V and see if the problem can be fixed as well. The ATMEL documentation says that there is no workaround to this problem, and they recommend using VREF below 2.4V or Vcc – 0.6V

The XMEGA is a very advanced and interesting device. The only disadvantage is that it is very difficult to get good documentation, user experiences, etc. So I will be preparing different settings and publishing the results.

Update: I checked the source code and VREF was set to AVCC, and AVCC = Target Voltage. That is why the only way to change VREF to 2.0V was to lower the complete target board (STK600) voltage to 2.0V. I modified the source code to use external VREF for DAC channel A, and the result is that I can set the target board voltage to 3.5V and VREF to 2.0V and now the example works ok, without noise in the SAWTOOTH signal.

DAC external AREF

DSO channel 1 (yellow) is the sawtooth signal output, with Vmax = 2.0V and channel 2 (blue) is VTarget, with Vmax = 3.5V.

Assembling the NKC Electronics JTAG ICE Clone Board (Rev. B)

March 12th, 2009

Assembling the NKC Electronics JTAG ICE CLONE Board (Rev. B)

by NKC Electronics

SCHEMATICS (right click –> view image)

jtag schematic

JTAG ICE Clone board is an implementation of the Aquaticus JTAG ICE clone. The Kit includes the PCB and all the parts requiered to build a fully functional clone of AVR JTAG ICE. It can even be upgraded using AVR-STUDIO when a new firmware is released by Atmel.

This guide covers the assembly process of the JTAG ICE clone Rev B kit (marked Rev B in the PCB)

First, unpack the kit and start with the PCB.

The JTAG ICE clone board has all the component values printed on the PCB, making the use of the schematic almost unnecessary.

jtag ice clone kit

We will install the passive components (resistors, capacitors, etc) first.

jtag ice passive

Start by soldering the resistors R1 to R7, C3 to C9 ceramic capacitors, C10 electrolytic capacitor and D2 diode

R1 10 K resistor
R2, R3, R4, R6 1 K resistor
R5, R7 4.7 K resistor
C3, C4, C5, C6, C7, C8, C9 0.1uF ceramic capacitor
D1 1N4148 diode
C10 10uF electrolytic capacitor

jtag ice clone kit

Next identify and separate the 2 22pF ceramic capacitors, 2 LEDs and the crystal

C1, C2 22pF ceramic capacitor
Q1 7.3728 crystal
PWR, JTAG 3mm LED

jtag ice clone kit

Now separate the 16-pin IC socket, 40-pin IC socket (wide), 10-pin male header, 5-pin male header, DB9 female PCB connector. Cut the 5-pin male header in one 3-pin header and one 2-pin header.

X1 DB9 female PCB connector
JTAG 2×5 male header
IC1 40-pin DIP socket
IC2 16-pin DIP socket
JP1 3-pin male header
JP2 2-pin male header

jtag ice clone kit

We are done with the soldering. You need to install the MCU and the RS232 (ICL3232, MAX3232, ST3232) driver in the sockets. The large chip is the ATMEGA16 Microcontroller. It is already programmed with the latest release of the JTAG ICE firmware, and the bootloader. Please, be very careful with the pins while inserting the ICs.

jtag ice clone kit

Insert the shunt shorting positions 2-3 of the 3-pin MODE header. The JTAG ICE clone board has two modes of operation:

  1. Programming / Upgrade mode
  2. Normal operation mode

Position 2-3 is the Normal operation mode (board is ready to connect to target board and start debugging)

jtag normal

Position 1-2 is the Programming mode. This mode is used to program or upgrade the JTAG ICE firmware. The firmware is distributed by Atmel with updates on the AVR Studio IDE. In the operation guide you will find the manual firmware upgrade process, explained in detail.

jtag program

This is how the JTAG ICE clone board looks ready to use with the 10-wire cable for the target board.
jtag ice clone kit

The target board must supply the power to the JTAG ICE clone board, using the standard JTAG connector. The board expects the power from the target board (2.7V to 5.0V) in the VTarget (VCC) pin. It is recommended to supply also the target voltage to the VTref pin (Use the provided JP2 and jumper to supply power to the board from the target device). The JTAG ICE board does not have voltage leveling circuit, so if you supply VTref, it must be the same as VTarget.

Testing the board:

  1. Start AVR Studio
  2. Verify mode jumper is in 2-3 Normal
  3. Connect JTAG port to target board. Supply VCC. At this point, you only need to supply VCC to the JTAG ICE clone board. No real circuit with target MCU is needed
  4. Both LEDs are on
  5. Select Connect to the Selected AVR Programmer avr studio connect
  6. You should see the following message: jtag avrstudio ocd error

This message means that AVR Studio detected the JTAG ICE clone board, but was not able to identify the target MCU (either it is not installed, or the installed MCU does not support JTAG).

The JTAG ICE clone board is now assembled and tested. Now you need a real target board to start debugging.

An important reminder: JTAG ICE requieres the JTAG fuse in the target MCU set: JTAG Interface Enabled [JTAGEN=0]. The setting looks like this in AVR Studio:

jtag avrstudio fuses

IMPORTANT NOTE to AVRStudio 4.13 sp2 users: There seems to be a bug in AVRStudio 4.13 sp2 that generates an error trying to read fuses using the JTAG interface. There is a fix posted in Atmel Norway website: http://www.atmel.no/beta_ware/as4/413sp2/stk500Dll.zip

Assembling the Freeduino Serial v2.0 Board (MAX232)

March 12th, 2009

Assembling the ArduinoTM Diecimila Compatible Freeduino Serial v2.0 Board

SCHEMATICS (click on images to enlarge)
freeduino serial schematic

The Arduino diecimila compatible Freeduino serial board is a special version of the Arduino serial board designed by NKC Electronics. The board is diecimila compatible (autoreset) and includes the 13 digital pin LED for easy diagnostics and basic LED sketch execution. The v2.0 board uses a MAX232 compatible chip for interfacing with RS232. The older v1.0 board used two transistors, but had some reliability issues with auto-reset and sketch uploading.
First, unpack the kit

freeduino serial KIT

and start with the PCB.

Let’s start with the power portion of the schematic using the following parts:

DC1 DC power jack
D1 1N4004 diode
C5 100nF ceramic capacitor
C6, C7 47uF (or 33uF or 22uF) electrolytic capacitor
IC2 7805 5V positive voltage regulator
Power LED 3mm LED
R2 330 ohm resistor

Freeduino serial KIT

Plug a wall plug voltage regulator (+7V to +12V). The LED lights up, indicating that the Power supply is working.
NOTE: This board is shields friendly as the 7805 voltage regulator is mounted horizontally.

Next continue with the soldering of the RS232 components:

Freeduino serial KIT

X1 DB9 female PCB adapter
IC3 16-pin IC socket
C4, C8, C9, C10, C11, C12 0.1uF (100nF) ceramic capacitors

Solder the rest of the components:

Freeduino serial KIT

R3 1.5Kohm resistor
R4, R6 1 Kohm resistor
R5 10 Kohm resistor
C2, C3 22pF ceramic capacitor
C1 0.1uF (100nF) ceramic capacitor
13 3mm LED (Arduino pin 13 status LED)
Q1 16 MHz crystal
RESET Reset switch
IC1 28-pin IC socket
ICSP 2×3 pin male header

Now solder the headers and sockets:

POWER & Analog In 6-pin female header
Digital 2 x 8-pin female header

Freeduino serial KIT

Pay special attention to the alignment of the female headers.

Freeduino serial KIT

And finally install the ATMEGA168/ATmega328P MCU and the MAX232 (or HIN232 / ICL232 / ICL3232) chips.

Freeduino serial KIT

Freeduino serial KIT

The board is ready to be used. Start the Arduino IDE and load the BLINK sketch from the examples directory. Verify that ATMEGA168 (or Duemilanove with ATmega328) is selected in Tools –> Microcontroller (MCU) and Arduino Diecimila in the Tools –> board option. Select the COM port number corresponding to the serial interface where the Freeduino serial board is connected to. Press the “Upload to I/O board” button in Arduino and the board should autoreset and complete the programming. If you selected correctly the BLINK sketch, the LED “13” must start blinking once every 2 second (0.5Hz).

The board has space for an optional 3.3V regulator (78L33 TO-92 footprint) with it’s associated decoupling 0.1uF capacitor (C13).

Freeduino serial KIT

http://www.nkcelectronics.com/arduino.html