Wednesday, March 26, 2014

XMEGA delay Library Test

Test result of delay libraries.

// Test environment:
// ATxmega256A3BU, Atmel Studio 6.2
// T = 297 K, Vcc = 3.340 V


// delay routines - ASF
// RC2M PLL x16 @32M
delay_ms( 100 );    // error: +19.0 %
delay_us( 100 );    // error: +14.5 %
delay_us( 50 );     // error: +14.8 %
delay_us( 5 );      // error: - 1.0 %
delay_us( 1 );      // error: -87.7 %

// RC32M @32M
delay_ms( 100 );    // error: +62.2 %
delay_us( 100 );    // error: +13.6 %
delay_us( 50 );     // error: +13.4 %
delay_us( 5 );      // error: - 2.1 %
delay_us( 1 );      // error: -87.9 %



// 'delay.h' - AVR GCC
// RC32M @32M
_delay_ms( 100 );   // error: - 2.8 %
_delay_us( 100 );   // error: - 2.7 %
_delay_us( 50 );    // error: - 2.5 %
_delay_us( 5 );     // error: - 0.3 %
_delay_us( 1 );     // error: + 9.5 %

// RC32M @32M - DFLL auto calibration enabled
_delay_ms( 100 );   // error: + 0.05%
_delay_us( 100 );   // error: + 0.2 %
_delay_us( 50 );    // error: + 0.3 %
_delay_us( 5 );     // error: + 2.6 %
_delay_us( 1 );     // error: +12.5 %

// RC2M PLL x16 @32M - DFLL auto calibration enabled
_delay_ms( 100 );   // error: - 0.1 %
_delay_us( 100 );   // error: + 0.1 %
_delay_us( 50 );    // error: + 0.2 %
_delay_us( 5 );     // error: + 2.5 %
_delay_us( 1 );     // error: +12.5 %




So best choice will be...

Use DFLL auto calibration for both,

Internal  2 MHz RC oscillator -> PLL x16 -> System Clock @32 MHz
(Calibration reference: TOSC, high quality 32.768 kHz. A.K.A watch crystal)

Internal 32 MHz RC oscillator -> for USB 
(Calibration reference: USB start of frame)

Tuesday, March 25, 2014

Simple Blink example for XMEGA (using ASF)

Environment

Board: ATXMEGAA3BU-XPLD
Device: ATxmega256A3BU
Debugger: Atmel-ICE
IDE: Atmel Studio 6.2b - full



It's easy! Just follow the steps.




Connect the board, debugger to PC.
Look at that Adapter board.
It's ridiculous!!!




Run Atmel Studio. SPLASH!



New Project (Ctrl + Shift + N)


Board Selection
(If you are using other board. Just select the device you are using.)


main.c is in the 'src' folder




Now let's add some ASF modules for Blink project.
ASF Wizard (Alt + W)

Search for 'Delay routines'
Add >>
Apply




It's just a summary. Press 'OK'


Got all modules. Time to code.


It is just a code for blink! Simple!
Read the comments.




Build the project(F7), Start Without Debugging(in the Debug menu)

than Project Properties window ( Alt + F7 ) pops up.

Choose correct tool and interface.


Start Without Debugging(in the Debug menu) again.

Success!

Sunday, March 23, 2014

XMEGA-A3BU 구매!



항상 Atmel ATmega128 만 다루다가.


XMEGA 시리즈는 그 존재만 알고 있었는데요.


이번에 한번 써보고 싶었습니다.



사실 ATmega에 DAC 이 없어서, perf 보드에 R-2R ladder 만들다가...


내가 왜 이걸 하고 있지? 생각이 들어서 DAC이 내장된걸 한번 써보고 싶었습니다.




Atmel에 직접 주문했고, 금요일에 받았습니다.

상자가 작은겁니다. 제손이 큰거 아님.



정전기 방지 포장이라고 자랑해서 함 측정해봄;;



처음 전원 넣었을 때


USB DFU bootloader 와  데모 프로그램이 미리 올려져 있습니다. 
사진은 없지만 보드에 있는 몇몇 센서 측정값과 RTC 기능을 확인해 볼 수 있습니다.








아래 내용은 Atmel 웹페이지에서 발췌



Features

  • Atmel® ATxmega256A3BU microcontroller
  • FSTN LCD display with 128x32 pixels resolution
  • Battery backup
  • Analog sensors
    • Ambient light sensor
    • Temperature sensor
  • Analog filter
  • Digital I/O
    • Three mechanical buttons
    • Two user LEDs
    • One power LED
    • One status LED
    • Four expansion headers
  • Touch
    • One Atmel® QTouch button
  • Memory
    • Atmel® AT45DB642D DataFlash® serial flash
    • Footprint for Atmel AT25DF series serial flash devices