SiFli-Wiki SiFli-Wiki SiFli-Wiki
  • User Guide
  • Examples
  • API Documentation
  • About Us
/
  • English
  • 中文

Quick Start

  • Getting Started Guide
  • Product Documentation Summary

Software Development

  • SDK Programming Guide
  • API Documentation
  • Solution Programming Guide
  • FAQ Frequently Asked Questions
    • Questions related to development tools
      • 1 Compilation Related
      • 2 Jlink
      • 3 KEIL
      • 4 Ozone
      • 5 SiFli
      • 6 Trace32
      • 7 SystemView
      • 8 Serial Port
      • 9 Source Insight Related
    • Issues concerning chips
      • 1 GPIO Related
      • 2 Timer-Related
      • 3 Interrupt Related
      • 4 Watchdog Related
      • 5 RTC Related
      • 6 ADC Related
      • 7 I2C Related
      • 8 Low Power Related
      • 9 PWM
      • 10 System
      • 11 Bluetooth
      • 12 USB Related
      • 13 UART Related
      • 14 Dual-Core Related
      • 15 I2S Related
      • 13 SPI Related Issues
    • Peripheral driver debugging issue
      • 1 Common Issues in LCD Debugging
      • 2 Common Issues in Sensor Debugging
      • 3 Common Issues in Flash Debugging
      • 4 Common Issues in Motor Debugging
    • Software Debugging Related Issues
      • 1 Log Debugging
      • 2 Online Debugging Methods
      • 3 Dump Memory to Recover Crash Scene
      • 4 Methods for Saving Crash Dump
  • Application Note
    • SF32LB52X Boot and Low Power Process
    • Low Power Development Guide
    • NandFlash_BBM Parsing Guide
  • Best Practices
    • AI XiaoZhi

Hardware Development

  • Sifli Selection Manual
  • Chip Hardware Design Guide
    • SF32LB52x - Hardware Design Guide
    • SF32LB52X - Hardware Design Guide
    • SF32LB56xU - Hardware Design Guide
    • SF32LB56xV - Hardware Design Guide
    • SF32LB58x - Hardware Design Guide
    • SF32LB55x - Hardware Design Guide
  • Development Boards
    • SF32LB52-DevKit-LCD Development Board User Guide
    • Sich Dev Board LCM Adapter Board Guide
    • SF32LB52-DevKit-ULP Development Board User Guide
    • SF32LB52-DevKit-Nano Development Board User Guide
    • SF32LB56-DevKit-LCD Development Board User Guide
    • SF32LB58-DevKit-LCD Development Board User Guide
  • Module

Software Tools

  • Summary of Software and Hardware Tools
    • Firmware Burning Tool Impeller
    • Graphics Conversion Tool
    • Storage Debugging Tools
      • Flash Chipid and Type Configuration Guide
    • Screen Module Debugging
      • Introduction to Screen Modules
      • Screen Module Framework Introduction
      • Directory Structure Introduction
      • Adding Screen Module (1) – Adding Files (Copying Files)
      • Add Screen Module (2) – Modify the Copied Driver File
      • Add Screen Module (3) – Modify Kconfig/Menuconfig
      • Adding Screen Module Operation Examples
      • FAQ
      • Appendix
        • Screen Driver Callback Functions
        • Application Layer vs. Module Driver Layer Function Correspondence Table
        • List of Supported Screen Modules
    • sftool

Product Introduction

  • About SiFli Technologies

On this page

  • 2.1 Delay Functions
  • 2.2 Get Timestamp, Tick Value, and RC10K Oscillation Frequency
  • 2.3 View Existing Timer Commands via UART
OpenSiFli/SiFli-Wiki 0 0
Edit this page
  1. SiFli-Wiki /
  2. FAQ Frequently Asked Questions /
  3. Issues concerning chips /
  4. 2 Timer-Related

2 Timer-Related¶

2.1 Delay Functions¶

1, HAL layer delay functions: (equivalent to instruction loops in while, the delay will not switch to other threads)

HAL_Delay(10); /* Delay 10ms */
HAL_Delay_us(10); /* Delay 10us */

2, RTT interface delay functions:
When the RTT interface delay functions are executed, they will switch to other threads, such as the idle thread. If the sleep threshold is lower than the delay duration, it will enter Standby sleep

rt_thread_delay(100); /* Delay 100ms */

2.2 Get Timestamp, Tick Value, and RC10K Oscillation Frequency¶

1, Get timestamp:

/* 32768 crystal clock, the register value increments by 1 every 1/32768 seconds */
/* RC10K clock, the register value increments by 1 approximately every 1/9000 seconds */
uint32_t start_time = HAL_GTIMER_READ(); 

2, Get the Tick value that increments every 1ms:

rt_tick_t start_timer = rt_tick_get(); /* RTT system function, the return value increments by 1 every 1ms */
uint32_t tickstart = HAL_GetTick();  /* HAL layer function, the return value increments by 1 every 1ms */

3, Get the current clock frequency:

/* 32768 crystal clock, returns 32768 */
/* RC10K clock, returns a value between 8k-10k */
uint32_t mcuOscData = HAL_LPTIM_GetFreq(); 

2.3 View Existing Timer Commands via UART¶

list_timer


alt text
Explanation of list_timer status:
The first column “timer” is the timer name;
The second column “periodic” is the timer period (hexadecimal, unit: ms);
The third column “timeout” is the timestamp for the next timer event;
The fourth column “flag” indicates whether the timer is active,
As shown in the figure, the only active timer is the “main” timer (the delay function is also a timer), with a wake-up period of 0xbb8 (3000ms).

Previous
1 GPIO Related
Next
3 Interrupt Related

2025, SiFli

Made with Sphinx and Shibuya theme.