Giter Site home page Giter Site logo

microchip-pic-avr-examples / avr128db48-getting-started-with-xoschf-mplab Goto Github PK

View Code? Open in Web Editor NEW
0.0 5.0 0.0 28 KB

These MPLAB X bare metal examples in Getting Started with High Frequency Crystal Oscillator (XOSCHF) in AVR® DB (TB3272), show how the XOSCHF and Clock Failure Detection (CFD) is used on the AVR DB family of microcontrollers.

Makefile 50.92% C 49.08%
getting-started-with-xoschf avr-db

avr128db48-getting-started-with-xoschf-mplab's Introduction

MCHP

Getting Started with External High-Frequency Oscillator on AVR® DB MCUs

The High Frequency Crystal Oscillator (XOSCHF) enables the use of an external crystal or an external clock signal up to 32 MHz. This can be used as a clock source for the Main Clock (CLK_MAIN), the Real-Time Counter (RTC) and the 12-Bit Timer/Counter Type D (TCDn).

The Clock Failure Detection (CFD) feature can be used to detect if the output from a clock source stops and can switch the Main Clock to a different clock source to continue operation or shut down operation safely.

These examples show the following use cases for XOSCHF and CFD on AVR® DB MCUs:

  • XOSCHF with External Crystal: Initialize XOSCHF for external crystal and change the main clock source to XOSCHF
  • XOSCHF with External Clock: Initialize XOSCHF for external clock signal and change the main clock source to XOSCHF
  • RTC with XOSCHF: Use XOSCHF as clock source for the RTC
  • TCD with XOSCHF: Use XOSCHF as clock source for TCD0
  • TCD with XOSCHF and PLL: Initialize the PLL with XOSCHF as clock source and use the PLL as clock source for TCD0
  • CFD on XOSCHF: Initialize the CFD to monitor XOSCHF, enable the interrupt, toggle an LED if the clock source fails
  • CFD on Main Clock with NMI: Initialize the CFD to monitor Main Clock with XOSCHF as clock source, enable the interrupt as a Non-Maskable Interrupt (NMI), toggle an LED with frequency derived from Main Clock

Related Documentation

Software Used

Hardware Used

Setup

The AVR128DB48 Curiosity Nano comes with a 16 MHz crystal soldered on. This can be used for most of the example projects, except for the external clock and RTC examples.

  • XOSCHF with External Clock:
    • Disconnect the crystal by cutting the two straps on the top side of the board next to the crystal (J215, J216)
    • Connect the I/O lines to the edge connector by placing solder blobs on the circular solder points marked PA0 and PA1 on the bottom side of the board (J213, J214)
    • Connect a clock source to PA0 on the edge connector
  • RTC with XOSCHF: Replace the 16 MHz crystal with one running at maximum 1/4 of the CLK_MAIN frequency

Operation

  • Connect the AVR128DB48 Curiosity Nano to a computer using a USB cable
  • Clone the repository or download the zip to get the source code
  • Open the project folder you want to run with MPLAB X
  • Compile and run the code

Conclusion

After going through these examples you should have a better understanding of how to set up different use cases for the XOSCHF on AVR DB family microcontrollers.

avr128db48-getting-started-with-xoschf-mplab's People

Contributors

carlehe avatar egilro avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.