Giter Club home page Giter Club logo

stm32-output-pps's Introduction

Hardware is a STM32F030F4P6 with 12MHz TCXO, communication is via uart. Clocks are setup for 12MHz HSE (bypass not crystal) and 48MHz PLL

Depends on make and arm-none-eabi-gcc being in your path. Recommended using cygwin on Windows or Linux.

arm-none-eabi-gcc should come with newlib (or other embedded c library)

"make" - builds the binary, output is in build/output-pps-uart.elf + build/output-pps-uart.bin

"make flash" - build the binary and flash it with a ST-Link (depends on ST-LINK_CLI being in your path)

Use STM32CubeMX to view the pinout or see the source code in Src/stm32f0xx_hal_msp.c

  • Src/adc.c - ADC (for core temperature, measured at 10Hz)
  • Src/timer.c - hardware timers driving 1PPS (TIM1 = drives PPS output, TIM3 = overflows at 1khz and drives TIM1)
  • Src/uart.c - uart print and receive
  • Src/main.c - setup and main loop
  • Src/commandline.c - uart commandline
  • Src/stm32f0xx_hal_msp.c - auto-generated GPIO mapping code
  • Src/stm32f0xx_it.c - auto-generated interrupt handlers
  • Src/system_stm32f0xx.c - auto-generated system initialization

The function timer_ppt in Src/timer.c converts temperature sensor reading into an expected TCXO frequency error. Measure your TCXO and use your own TCXO_* values for best results.

commands:

  • temp - CPU temp sensor
  • vcc - CPU voltage sensor
  • ppb - print timer freq (temperature compensation + static configured)
  • offset - print timer estimated offset and last used counter adjustment
  • o [ns] - add offset, limited to +/- 214,748,364 ns and adjusted at 250ppm
  • f [ppb] - set static configured frequency in parts per billion, limited to +/-250ppm
  • help - print help

Example uart session (comments marked with #):

> f -90
compensation 806 ppb, configured -90 ppb

# clock drifted 1861ns fast in 131 seconds, 14ppb

> f -76
compensation 798 ppb, configured -76 ppb
> o -790
adding -790 ns
offset -799 ns
last adjust 48034

# clock drifted 1125ns slow in 303 seconds, 3ppb

> f -79
compensation 806 ppb, configured -79 ppb
> o 1361
adding 1361 ns
offset 1353 ns
last adjust 48034

After the adjustments above, the clock was left to run. Below is the offset between this module's PPS and a GPS module's PPS:

Offset

Allan deviation of the above offset

adev

stm32-output-pps's People

Contributors

ddrown avatar

Stargazers

Zhiwen Zhou avatar  avatar Mithun Diddi avatar wolong avatar Ilya Pronyashin avatar Haojia Li avatar Paul G avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

wolonggl

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.