没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
Introduction
This document applies to STM32CubeG4 MCU Package, for use with STM32G4 Series microcontrollers.
The CORDIC is a hardware accelerator designed to speed up the calculation of certain mathematical functions, notably
trigonometric and hyperbolic, compared to a software implementation.
The accelerator is particularly useful in motor control and related applications, where algorithms require frequent and rapid
conversions between rectangular (x, y) and angular (amplitude, phase) co-ordinates.
This application note describes how the CORDIC accelerator works on STM32G4 Series microcontrollers, its capabilities and
limitations, and evaluates the speed of execution for certain calculations compared with equivalent software implementations.
The example code to accompany this application note is included in the STM32CubeG4 MCU Package available on
www.st.com. The examples run on the NUCLEO-G474RE board.
Getting started with the CORDIC accelerator using STM32CubeG4 MCU Package
AN5325
Application note
AN5325 - Rev 1 - May 2019
For further information contact your local STMicroelectronics sales office.
www.st.com
1 General information
The STM32CubeG4 MCU Package runs on STM32G4 Series microncontrollers, based on Arm
®
Cortex
®
-M4
processors.
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
AN5325
General information
AN5325 - Rev 1
page 2/20
2 CORDIC introduction
Cordic (coordinate rotation digital computer) is a low-cost successive approximation algorithm for evaluating
trigonometric and hyperbolic functions.
Originally presented by Jack Volder in 1959, it was widely used in early calculators.
In trigonometric (circular) mode, the sine and cosine of an angle
θ
are determined by rotating the vector [0.61, 0]
through decreasing angles tan
-1
(2
-n
) (n = 0, 1, 2,...) until the cumulative sum of the rotation angles equals the
input angle. The x and y cartesian components of the rotated vector then correspond respectively to the cosine
and sine of
θ.
This is illustrated in Figure 1 for an angle of 60 deg. The vector undergoes a scaling by 1/0.61
(~1.65) over the course of the calculation.
Figure 1. CORDIC circular mode operation
0°
30°
60°
90°
1
2
3
0.2
0.4
0.6
0.8
y (sin q)
x (cos q)
q
Inversely, the angle of a vector [x, y] is determined by rotating 0.61[x, y] through successively decreasing angles
to obtain the unit vector [1, 0]. The cumulative sum of the rotation angles gives the angle of the original vector,
corresponding to arctangent (y/x).
The CORDIC algorithm can also be used for calculating hyperbolic functions (sinh, cosh, atanh) by replacing the
circular rotations by hyperbolic angles tanh
-1
(2
-j
) (j = 1, 2, 3...), see Figure 2. CORDIC hyperbolic mode operation.
The natural logarithm is a special case of the inverse hyperbolic tangent, obtained from the identity:
ln x =
2.tanh
−1
x + 1
x − 1
The square root function is also a special case of the inverse hyperbolic tangent. When calculating the atanh the
CORDIC also calculates √(cosh
2
t - sinh
2
t) as a by-product. So the square root is obtained from:
x
= x +
1
4
2
− x −
1
4
2
AN5325
CORDIC introduction
AN5325 - Rev 1
page 3/20
Additional functions are calculated from the above using appropriate identities:
tanh x =
sinh x
cosh x
e
x
= sinℎ x + cosℎ x
log
2
x = log
2
e ln x = 1.442695041 ln x
log
10
x = log
10
e ln x = 0.434294482 ln x
The CORDIC algorithm lends itself to hardware implementation since there are no multiplications involved (the
fixed scaling factor A is pre-loaded). Only add and shift operations are performed. This also means that it is
ideally suited to integer arithmetic.
Figure 2. CORDIC hyperbolic mode operation
t/2
1
y (sinh t)
x (cosh t)
hyperbola: x
2
- y
2
= 1
0.5
1.0
0.5
1.0
3
2
2.1 Limitations
In circular mode, the CORDIC converges for all angles in the range -π to π radians. The use of fixed point
representation means that input and output values must be in the range -1 to +1. Input angles in radians must be
multiplied by 1/π and output angles must be multiplied by π to convert back to radians.
The modulus must be in the range 0 to 1, whether converting from polar to rectangular or rectangular to polar.
This means that phase(1.0, 1.0) gives false results since the modulus (√2) is out of range and saturates the
CORDIC engine, even if only the phase is needed.
In hyperbolic mode, x = cosh t being defined only for x ≥ 1, all inputs and outputs are divided by 2 to remain in the
fixed point numeric range. Hence the CORDIC without additional scaling supports values of x = cosh(t) in the
range 1 to 2 (ie. 0.5 to 1 after division by 2), which corresponds to hyperbolic angle magnitude t in the range 0 to
1.317 (cosh
-1
2).
It is possible to increase the range by additional scaling. However, the CORDIC algorithm stops converging for |t|
> 1.118. This is because the successive approximation step size, |δt
j
| is equal to the magnitude of the hyperbolic
angle |tanh
-1
2
-j
|, where j is the iteration number. So as j increases, the step size decreases. It so happens that as
j tends to infinity, the sum of |δt
j
| tends to 1.118:
∑
j = 1
∞
tanh
−1
2
− j
= 1.118
This is illustrated in Figure 3. Hyperbolic convergence limit.
AN5325
Limitations
AN5325 - Rev 1
page 4/20
剩余19页未读,继续阅读
资源评论
adu00
- 粉丝: 0
- 资源: 33
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Linux常用命令及用法说明
- 基于Matlab的FFT频谱分析及IIR数字滤波器设计
- AutoCAD高压低压电气开关柜设备接线图图纸
- AutoCAD电气图纸建筑电气开关柜常用cad图纸
- 使用ASP.NET Core和Entity Framework Core来构建一个基本的进销存系统.rar
- 深度学习经典数据集+FER2013面部表情识别+附带使用方法的python代码
- Python中,要实现连接多个相机并识别多个二维码.rar
- 使用FFT算法对一个信号进行分析.rar
- 171cms游戏应用下载系统源码.zip
- 基于jsp+servlet+mysql蛋糕甜品店购物网站源码+数据库(期末大作业).zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功