CC23x0R5DriverLibrary
[cpu.h] CPU
Collaboration diagram for [cpu.h] CPU:

Functions

void CPUDelay (uint32_t count)
 Provide a small non-zero delay using a simple loop counter. More...
 

Detailed Description

Introduction

The CPU API provides a set of functions performing very low-level control of the system CPU. All functions in this API are written in assembler in order to either access special registers or avoid any compiler optimizations. Each function exists in several compiler specific versions: One version for each supported compiler.

Function Documentation

§ CPUDelay()

void CPUDelay ( uint32_t  count)

Provide a small non-zero delay using a simple loop counter.

This function provides means for generating a constant length delay. It is written in assembly to keep the delay consistent across tool chains, avoiding the need to tune the delay based on the tool chain in use.

Note
It is not recommended using this function for long delays.

Notice that interrupts can affect the delay if not manually disabled in advance.

The delay depends on where code resides and the path for code fetching:

  • Code in flash, cache enabled, prefetch enabled : 4 cycles per loop (Default)
  • Code in flash, cache enabled, prefetch disabled : 5 cycles per loop
  • Code in flash, cache disabled : 7 cycles per loop
  • Code in SRAM : 6 cycles per loop
  • Code in GPRAM : 3 cycles per loop
Note
If using an RTOS, consider using RTOS provided delay functions because these will not block task scheduling and will potentially save power.

Calculate delay count based on the wanted delay in microseconds (us):

  • count = [delay in us] * [CPU clock in MHz] / [cycles per loop]

Example: 250 us delay with code in flash and with cache and prefetch enabled:

  • count = 250 * 48 / 4 = 3000
Parameters
countis the number of delay loop iterations to perform. Number must be greater than zero.
Returns
None

Referenced by I2CControllerCommand(), and TempDiodeGetTemp().