Giter Site home page Giter Site logo

stm8_headers's Introduction

STM8 Device Headers

Open-Sources device headers for all STM8 microcontroller series, namely STM8A, STM8S, STM8L, STM8AF and STM8AL.

Device headers

XML Device Description

Headers were generated from device descriptions in XML format, which are in folder XML. These descriptions could be used e.g. for a graphical debugger interface.

Related Projects

The below projects have been ported to use these open-sources device headers for STMo.

atomthreads

Example Projects

These projects have been tested successfully with SDCC, Cosmic and IAR.

adc1_scan

  • perform an ADC1 scan of AIN0..AIN3 every 1ms
  • read result in TIM4 ISR and trigger next scan
  • send result every 1s

adc_continuous_1ch

  • measure 1 channel continuously
  • read ADC value in timer ISR every 1ms
  • every 500ms print ADC value via UART using printf()
  • works with ADC1 (advanced) & ADC2 (basic)

adc_single-shot_1ch

  • measure 1 channel every ~500ms in single shot mode
  • print value via UART using printf()
  • works with ADC1 (advanced) & ADC2 (basic)

beeper

  • activate beeper output via option bytes
  • generate different frequencies on BEEP pin
  • no LSI calibration (yet)
  • no interrupts

benchmark_biquad

  • benchmark for comparison of Biquad algorithms performance

blink_interrupt

  • blink LED in TIM4 interrupt service routine

blink_noInterrupt

  • blink LED with a simple NOP() loop

calculate_CRC

  • periodically calculate CRC over pre-defined data
  • measure time for CRC calculation
  • print time and calculated CRC to UART
  • CRC32 code copied from https://github.com/basilhussain/stm8-crc
  • SDCC uses optimized assembler, IAR and Cosmic C implementation

CLI_console


clock_switch

  • periodically:
    • switch between internal and external clock with timeout
    • print active clock via UART
  • for extra safety use independent watchdog (IWDG)

I2C_LCD

  • Periodically print text to 2x16 char LCD attached to I2C
  • LCD type Batron BTHQ21605V-COG-FSRE-I2C 2X16 (Farnell 1220409)

IWDG_watchdog

  • initialize IWDG to 100ms, service every 50ms
  • print millis to UART every 500ms
  • if 'r' received, stop watchdog service --> reset

low-power_auto-wake

  • enter power-down mode with wake via port-ISR or AWU

millis_delay

  • implement 1ms ISR, millis(), micros() etc., similar to Arduino

Modbus_RTU


Modbus_RTU_auto-address

  • small Modbus RTU client implementation to demonstrate auto-addressing
  • demonstrate detection of colliding Modbus IDs and resolving the issue
  • see corresponding Python server in Utils

pin_interrupt

  • TLI interrupt on pin D7 (not port). Corresponds to INTx on Arduino

pin_read_write

  • read and write pin states without interrupts

port_interrupt

  • port interrupt on pin PE5. Corresponds to port change interrupts on Arduino

PWM_2ch_phase-shift

  • configure timer 1 for up-down counter with 50kHz frequency
  • generate 2x PWM on TIM1_CH1 and TIM1_CH3
  • ramp up/down duty cycle

PWM_generate

  • generate a PWM on pin PD2/TIM3_CH1 (=pin 3 on sduino)

read_unique_ID

  • read unique identifier and print via UART
  • Note: UID not supported by all devices

read_write_D-flash

  • save data to D-flash/EEPROM and read back

read_write_option_bytes

  • change option bytes, e.g. activate/deactivate the ROM-bootloader

read_write_P-flash

  • save data to P-flash and read back

serial_gets_printf

  • serial input/output with gets and printf
  • without interrupts or FIFO

serial_printf

  • serial output via printf
  • without interrupts or FIFO

serial_printf_FIFO_interrupt

  • serial output via printf
  • using Tx & Rx FIFO and interrupts
  • similar to Arduino Serial class

serial_write

  • echo read bytes from UART
  • without interrupts or FIFO

Single-Wire_DS18B20


SPI_LED_MAX7219


STM8_StdPeriphLib

  • mix with functions/headers of the STM8S Standard Peripheral Library (SPL)
  • SDCC compatibility requires patch, see e.g. here.

Task_Scheduler

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.