APPLICATION NOTE. AT10828: DALI Slave Stack for SAM D20/D21 ATSAM D MCU. Introduction

Similar documents
SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

CryptoAuth Xplained Pro

APPLICATION NOTE. Secure Personalization with Transport Key Authentication. ATSHA204A, ATECC108A, and ATECC508A. Introduction.

AT88CK490 Evaluation Kit

AVR151: Setup and Use of the SPI. Introduction. Features. Atmel AVR 8-bit Microcontroller APPLICATION NOTE

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

APPLICATION NOTE. AT16268: JD Smart Cloud Based Smart Plug Getting. Started Guide ATSAMW25. Introduction. Features

USER GUIDE EDBG. Description

QT1 Xplained Pro. Preface. Atmel QTouch USER GUIDE

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

APPLICATION NOTE. Authentication Counting. Atmel CryptoAuthentication. Features. Introduction

USER GUIDE. ZigBit USB Stick User Guide. Introduction

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

AVR106: C Functions for Reading and Writing to Flash Memory. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

APPLICATION NOTE. AT17284: Proximetry Cloud Based Smart Plug User Guide. SMART ARM-based Microcontrollers. Introduction. Features

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

APPLICATION NOTE. AT12405: Low Power Sensor Design with PTC. Atmel MCU Integrated Touch. Introduction

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

Introducing a platform to facilitate reliable and highly productive embedded developments

AVR131: Using the AVR s High-speed PWM. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

APPLICATION NOTE. Atmel AT04389: Connecting SAMD20E to the AT86RF233 Transceiver. Atmel SAMD20. Description. Features

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

General Porting Considerations. Memory EEPROM XRAM

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR127: Understanding ADC Parameters. Introduction. Features. Atmel 8-bit and 32-bit Microcontrollers APPLICATION NOTE

AT91SAM ARM-based Flash MCU. Application Note

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

AT11805: Capacitive Touch Long Slider Design with PTC. Introduction. Features. Touch Solutions APPLICATION NOTE

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

AT15007: Differences between ATmega328/P and ATmega328PB. Introduction. Features. Atmel AVR 8-bit Microcontrollers APPLICATION NOTE

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

AT12181: ATWINC1500 Wi-Fi Network Controller - AP Provision Mode. Introduction. Features. Atmel SmartConnect APPLICATION NOTE

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

AVR315: Using the TWI Module as I2C Master. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

AVR311: Using the TWI Module as I2C Slave. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Using the RS232 serial evaluation boards on a USB port

AN3332 Application note

SAMA5D2. Scope. Reference Documents. Atmel SMART ARM-based MPU ERRATA

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

Software Prerequisites Linux Ubuntu LTS. Estimated completion time: 15min. The goal of this hands-on is to:

AVR125: ADC of tinyavr in Single Ended Mode. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

AT88CK490 and AT88CK590

Designing Feature-Rich User Interfaces for Home and Industrial Controllers

Dell Spotlight on Active Directory Server Health Wizard Configuration Guide

AN3998 Application note

APPLICATION NOTE. AT05558: Wireless Manufacturing Test Kit. Atmel ATmega256RFR2. Description. Features

Atmel SMART ARM Core-based Embedded Microprocessors

AT09333: USB Host Interface (UHI) for Communication Class Device (CDC) Introduction. Atmel Microcontrollers APPLICATION NOTE

AVR126: ADC of megaavr in Single Ended Mode. Introduction. Features. AVR 8-bit Microcontrollers APPLICATION NOTE

USER GUIDE. ATWINC1500B Hardware Design Guidelines - IEEE b/g/n IoT Module. Atmel SmartConnect. Introduction

UM0834 User manual. Developing and debugging your STM8S-DISCOVERY application code. Introduction. Reference documents

Atmel Power Line Communications. Solutions for the Smart Grid

Implementing SPI Master and Slave Functionality Using the Z8 Encore! F083A

AN2680 Application note

AN3265 Application note

APPLICATION NOTE. AT10934: Audio Recorder with SAM G53-XPRO and MEMS MIC XPRO. SMART ARM-based Microcontrollers. Introduction.

APPLICATION NOTE. Atmel LF-RFID Kits Overview. Atmel LF-RFID Kit. LF-RFID Kit Introduction

APPLICATION NOTE. RF System Architecture Considerations ATAN0014. Description

Application Note. C51 Bootloaders. C51 General Information about Bootloader and In System Programming. Overview. Abreviations

Application Note. Atmel CryptoAuthentication Product Uses. Atmel ATSHA204. Abstract. Overview

Software Real Time Clock Implementation on MC9S08LG32

Dell One Identity Cloud Access Manager How to Configure vworkspace Integration

APPLICATION NOTE. Atmel AVR600: STK600 Expansion, Routing and Socket Boards. Atmel Microcontrollers. Introduction

DACC (Digital-to-Analog Converter Controller) The outline of this documentation is as follows: Module Overview. Special Considerations

Atmel AVR1017: XMEGA - USB Hardware Design Recommendations. 8-bit Atmel Microcontrollers. Application Note. Features.

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

Wireless Subwoofer TI Design Tests

Figure 1. 8-Bit USB Debug Adapter

Dell Statistica Statistica Enterprise Installation Instructions

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

AN11008 Flash based non-volatile storage

Atmel Norway XMEGA Introduction

ES_LPC4357/53/37/33. Errata sheet LPC4357/53/37/33. Document information

AN AES encryption and decryption software on LPC microcontrollers. Document information

Develop a Dallas 1-Wire Master Using the Z8F1680 Series of MCUs

Atmel AVR4027: Tips and Tricks to Optimize Your C Code for 8-bit AVR Microcontrollers. 8-bit Atmel Microcontrollers. Application Note.

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

Transcription:

APPLICATION NOTE AT10828: DALI Slave Stack for SAM D20/D21 ATSAM D MCU Introduction DALI stands for Digital Addressable Lighting Interface and targets for lighting control system. There is a specified global standard IEC 62386. The DALI stack implements the protocol set out in this standard. This application note introduces the DALI stack of LED modules for Atmel SMART SAM D20/D21 devices, including: Software structure Stack functions Input and output of stack Setup the demo system

Table of Contents 1 Recommended Reading... 3 2 Software Structure... 4 3 Stack Functions... 5 4 Input and Output of the Stack... 5 5 Setup the Demo System... 7 5.1 DALI Master Integrating DALI Power... 7 5.2 DALI Slave... 7 6 Reference... 8 6.1 Device Datasheet... 8 6.2 Atmel Studio... 8 6.3 Xplained Pro Evaluation Kit... 8 7 Revision History... 9 2

1 Recommended Reading There are several released application notes about our previous DALI solution. It is recommended to read these to get an overall idea about the DALI system. Some of these documents are also referred to later in this application note. AT03922: DALI Slave with XmegaE - Software User Guide This application note describes the DALI slave based on ATxmega32E5. It demonstrates the software architecture and its application programming interface (API). AT04022: DALI Slave with XMEGA E Hardware User Guide This application note introduces DALI slave hardware design including DALI interface, LED driver based on ATxmega32E5 device. AT06409: DALI Master with ATxmega32E5 User Guide This application note demonstrates DALI master reference design based on ATxmega32E5, with the DALI bus power supply integrated. And it shows setup process of a DALI system which is operated via PC software. AT01244: DALI Slave Reference Design This application note describes the DALI slave implementation based on ATmega88PA device. The above application notes include hardware and software packages which can be downloaded from www.atmel.com. They provide hardware design files, software source code, and PC tools. 3

2 Software Structure After downloading the software package of this application note and opening it with Atmel Studio 6, the SAM D20 project tree view should be as shown in Figure 2-1 below. Figure 2-1. SAM D20 DALI Slave Project Tree The SAM D21 DALI slave project tree is as same as the SAM D20 project tree. 4

The contents of the folders are: ASF: ASF (Atmel Software Framework) provides the low level drivers/services of microcontroller modules. config: Provide board, system clock, and external interrupt controller configuration files. dali: Provide the DALI application and stack files. dali_bit, dali_bod33, dali_eeprom, and dali_timer These folders contain the application files for the DALI stack. dali_bit dali_stack DALI bits are decoded and encoded here. EIC (External Interrupt Controller) peripheral is used for decoding. dali_bod33 When power off is detected, DALI slave need store the parameters into EEPROM if there is an update. BOD interrupt deals with this detection. dali_eeprom Provides read and write EERPOM functions. Additional BCC (Block Check Character) code is used for error detection. dali_timer System timers are provided here. They are used for DALI bit, frame and fade timing, PWM dimming, and random address seeds. The DALI stack is located in this folder. dali frame Provide the DALI frame process files. dali_cmd Provide DALI command implementation files. dali_hal Hardware abstraction layer, including a complete set of APIs for using hardware resources by DALI stack that is convenient for rapid design-in and smooth integration with varied peripherals. 3 Stack Functions For the DALI stack, the process and flowchart are same as that in application note AT03922. Refer to AT03922 2.2 Service and 3.2 Service Layer API Introduction sections for details. 4 Input and Output of the Stack The input and output of the stack act through functions defined in dali_hal.h. dali_hal_forward_disable_backward_enable( ) This function is used before the DALI slave starts to send a backward frame. This will disable DALI input detection and enable slave sending. It is necessary to disable input detection because the backward frame signal can route back to DALI input. dali_hal_forward_enable_backward_disable( ) 5

This function is used after DALI slave finishes sending a backward frame. This will re-enable DALI external input detection again. dali_hal_disable_fading_interrupt( ), dali_hal_enable_fading_interrupt( ) When operating the variables both active in stack and the fading interrupt, it must disable the interrupt inside stack functions to avoid conflict. After operation, re-enable the interrupt again. dali_hal_get_dali_input_level( ) This function detects DALI interface input voltage level used to check the interface failure state. dali_hal_disable_frame_timer_interrupt( ), dali_hal_enable_frame_timer_interrupt( ) Enable and disable the frame timer interrupt, after receiving a new frame, it is necessary to start a timer interrupt for frame and frame sequence timing. dali_hal_update_pwm_output( ) This function is used to update the PWM output for LED light dimming. dali_hal_get_seed0_value( ), dali_hal_get_seed1_value( ) These two functions generate random address seeds for auto address allocation. dali_hal_read_check_data( ) In system initialization, this function reads out the DALI parameters stored in EEPROM. When stack variables need executing outside, below functions offer channels for outside functions to get or set them. These functions list in file dali_top.h. * \brief Set the DALI bytes (address and data) to stack after decoding. void dali_set_addr_to_stack(uint8_t address); void dali_set_data_to_stack(uint8_t data); * \brief Set the DALI bytes received flag to stack after decoding. void dali_set_received_flag_to_stack(bool flag); * \brief Set current DALI byte sent status to stack when encoding. void dali_set_sent_status_to_stack(uint8_t status); * \brief Get the DALI byte sent status from stack to start encoding. uint8_t dali_get_sent_status_from_stack(void); * \brief Get the DALI sent byte from stack when encoding. uint8_t dali_get_sent_data_from_stack(void); * \brief Get the EEPROM update flag from stack for EEPROM write. uint8_t dali_get_eeprom_flag_from_stack(void); 6

* \brief Set the EEPROM update flag back to stack after EEPROM write. void dali_set_eeprom_flag_to_stack(uint8_t flag); * \brief Get the data address and size from stack for EEPROM write. uint8_t *dali_get_page0_data_addr_from_stack(void); uint8_t dali_get_page0_data_size_from_stack(void); uint8_t *dali_get_page1_data_addr_from_stack(void); uint8_t dali_get_page1_data_size_from_stack(void); 5 Setup the Demo System A typical DALI system contains DALI master, DALI slave, and DALI power. To setup this DALI demo system on SAM D20/21, see Figure 5-1 below. Figure 5-1. DALI Demo Diagram DALI SLAVE DALI Physical Layer Interface SAMD20 Xplained Pro PC DALI Master Kit USB DALI DALI BUS Power DALI Physical Layer Interface DALI SLAVE SAMD21 Xplained Pro DALI Slave Kit 5.1 DALI Master Integrating DALI Power Refer to DALI master application note AT06409 for details. PC software communicates with the DALI master to operate a DALI slave. 5.2 DALI Slave A SAM D20 Xplained Pro Evaluation Kit or a SAM D21 Xplained Pro Evaluation Kit plus DALI physical layer interface acts as a DALI slave. For the physical layer interface, refer to DALI slave hardware application note AT04022 section 4.1 DALI physical layer interface. Pin PA10 is used for DALI input and PA11 is output as defined in file dali_bit.h: #define DALI_INPUT_PIN #define DALI_OUTPUT_PIN PIN_PA10 PIN_PA11 LED0 on Xplained Pro is used as a lighting demo. On SAM D20 Xplained Pro, connect pin PA13 and PA14 together because PA13 is DALI dimming output and PA14 connects to LED0. On SAM D21 Xplained Pro, there is no such issue since DALI dimming output PB30 connects to LED0 directly. In the DALI stack the dimming is high level active by default. LED0 on the board is low level active, so the output must be inverted, this is done in dali_tc.c: 7

SAM D20: config_tc.waveform_invert_output = TC_WAVEFORM_INVERT_OUTPUT_CHANNEL_1; SAM D21: config_tcc.wave_ext.invert[dali_pwm_output] = true; Emulated EEPROM in SAM D device is required to store DALI parameters. The device EEPROM SIZE fuse must be programmed before the demo runs. If the EEPROM section is not allocated, the application will fail inside the EEPROM initialization routine. In this application, DALI stack takes two EEPROM pages, corresponding to 120 bytes. According to emulation software described in application note AT03265: SAM D20 EEPROM Emulator Service, 0x04 or less can be set to EEPROM SIZE fuse. Figure 5-2. EEPROM Fuse Setting For further development on SAM D20/21, a LED string driver should be implemented. For SAM D20, dedicated LED driver MSL20xx can be considered. Refer to DALI slave application note AT01244 section 2.3 LED driver. For SAM D21, since there is a fault module extension in the TCC peripheral, a buck LED driver is recommended. Refer to DALI slave application note AT04022 section 4.2 Buck LED driver. The principle is also explained in the application note AT04204: Design a Buck Converter with XMEGA E. 6 Reference 6.1 Device Datasheet SAM D20/21 datasheet are available on http://www.atmel.com/ in the Documents section of Atmel SAM D product page. 6.2 Atmel Studio Atmel Studio 6 is the integrated development platform (IDP) for developing and debugging Atmel ARM Cortex -M processor-based and Atmel AVR microcontroller (MCU) applications. The latest version of Atmel Studio can be downloaded from http://www.atmel.com/tools/atmelstudio.aspx. 6.3 Xplained Pro Evaluation Kit The SAM D20/21 Xplained Pro evaluation kits are ideal for evaluation and prototyping with the SAM D20/21 Cortex -M0+ processor-based microcontrollers. For SAM D20 kit: http://www.atmel.com/tools/atsamd20-xpro.aspx For SAM D21 kit: http://www.atmel.com/tools/atsamd21-xpro.aspx 8

7 Revision History Doc Rev. Date Comments 42386A 11/2014 Initial document release. 9

SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Atmel products are not designed for and will not be used in conne ction with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death ( Safety-Critical Applications ) without an Atmel officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and w eapons systems. Atmel products are AT10828: not designed DALI nor intended Slave for use Stack in military for SAM aerospace D20/D21 applications or [APPLICATION environments unless s pecifically NOTE] designated by Atmel as military-grade. Atmel products are not designed nor Atmel-42386A-DALI-Slave-Stack-for-SAM-D20/D21 intended use in automotive applications unless -ApplicationNote_112014 specifically designated by Atmel as automotive -grade. 10 Atmel Corporation 1600 Technology Drive, San Jose, CA 95110 USA T: (+1)(408) 441.0311 F: (+1)(408) 436.4200 www.atmel.com 2014 Atmel Corporation. / Rev.:. Atmel, Atmel logo and combinations thereof, AVR, Enabling Unlimited Possibilities, and others are registered trademarks or trademarks of Atmel Corporation in U.S. and other countries. ARM, ARM Connected logo, Cortex, and others are the registered trademarks or trademarks of ARM Ltd. Other terms and product names may be trademarks of others. DISCLAIMER: The information in this document is provided in connection with Atmel products. No license, express or implied, b y estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN THE ATMEL TERMS AND COND ITIONS OF SALES LOCATED ON THE ATMEL WEBSITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON -INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS AND PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accurac y or completeness of the contents of this document and reserves the right to make changes to specifications and products descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically provided otherwise, Atmel products are not suitable for, and shall not be used in, auto motive applications. Atmel products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life.