428KB

The following document contains information on Cypress products.
Colophon
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for any use that includes fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic control,
mass transport control, medical life support system, missile launch control in weapon system), or (2) for any use where
chance of failure is intolerable (i.e., submersible repeater and artificial satellite). Please note that Spansion will not be liable
to you and/or any third party for any claims or damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions. If any products described in this document
represent goods or technologies subject to certain restrictions on export under the Foreign Exchange and Foreign Trade Law
of Japan, the US Export Administration Regulations or the applicable laws of any other country, the prior authorization by the
respective government entity will be required for export of those products.
Trademarks and Notice
The contents of this document are subject to change without notice. This document may contain information on a Spansion
product under development by Spansion. Spansion reserves the right to change or discontinue work on any product without
notice. The information in this document is provided as is without warranty or guarantee of any kind as to its accuracy,
completeness, operability, fitness for particular purpose, merchantability, non-infringement of third-party rights, or any other
warranty, express, implied, or statutory. Spansion assumes no liability for any damages of any kind arising out of the use of
the information in this document.
®
®
®
TM
Copyright © 2013 Spansion Inc. All rights reserved. Spansion , the Spansion logo, MirrorBit , MirrorBit Eclipse ,
TM
ORNAND and combinations thereof, are trademarks and registered trademarks of Spansion LLC in the United States and
other countries. Other names used are for informational purposes only and may be trademarks of their respective owners.
Fujitsu Semiconductor Design (Chengdu) Co., Ltd.
Application Note
MCU-AN-500120-E-10
F²MC-8FX FAMILY
8-BIT MICROCONTROLLER
MB95410H/470H SERIES
ONE PHASE POWER METER
(CS5464) SOLUTION
CS5464 OPERATION
APPLICATION NOTE
CS5464 Operation V1.0.0
Revision History
Revision History
Version
Date
Updated by
Modifications
1.0.0
6/2/2011
Funny Chen
First Draft : Write the user manual of CS5464, and describe the
energy measure function on Power Meter solution.
This manual contains 14 pages.
Specifications are subject to change without notice. For further information please contact each office.
All Rights Reserved.
The contents of this document are subject to change without notice.
Customers are advised to consult with sales representatives before ordering.
The information, such as descriptions of function and application circuit examples, in this document are presented solely
for the purpose of reference to show examples of operations and uses of FUJITSU SEMICONDUCTOR device; FUJITSU
SEMICONDUCTOR does not warrant proper operation of the device with respect to use based on such information. When
you develop equipment incorporating the device based on such information, you must assume any responsibility arising
out of such use of the information.
FUJITSU SEMICONDUCTOR assumes no liability for any damages whatsoever arising out of the use of the information.
Any information in this document, including descriptions of function and schematic diagrams, shall not be construed as
license of the use or exercise of any intellectual property right, such as patent right or copyright, or any other right of
FUJITSU SEMICONDUCTOR or any third party or does FUJITSU SEMICONDUCTOR warrant non-infringement of
any third-party's intellectual property right or other right by using such information. FUJITSU SEMICONDUCTOR
assumes no liability for any infringement of the intellectual property rights or other rights of third parties which would
result from the use of information contained herein.
The products described in this document are designed, developed and manufactured as contemplated for general use,
including without limitation, ordinary industrial use, general office use, personal use, and household use, but are not
designed, developed and manufactured as contemplated (1) for use accompanying fatal risks or dangers that, unless
extremely high safety is secured, could have a serious effect to the public, and could lead directly to death, personal injury,
severe physical damage or other loss (i.e., nuclear reaction control in nuclear facility, aircraft flight control, air traffic
control, mass transport control, medical life support system, missile launch control in weapon system), or (2) for use
requiring extremely high reliability (i.e., submersible repeater and artificial satellite).
Please note that FUJITSU SEMICONDUCTOR will not be liable against you and/or any third party for any claims or
damages arising in connection with above-mentioned uses of the products.
Any semiconductor devices have an inherent chance of failure. You must protect against injury, damage or loss from such
failures by incorporating safety design measures into your facility and equipment such as redundancy, fire protection, and
prevention of over-current levels and other abnormal operating conditions.
Exportation/release of any products described in this document may require necessary procedures in accordance with the
regulations of the Foreign Exchange and Foreign Trade Control Law of Japan and/or US export control laws.
The company names and brand names herein are the trademarks or registered trademarks of their respective owners.
© 2011 Fujitsu Semiconductor Design (Chengdu) Co., Ltd.
MCU-AN-500120-E-10 – Page 2
CS5464 Operation V1.0.0
Contents
Contents
REVISION HISTORY ............................................................................................................ 2
CONTENTS .......................................................................................................................... 3
1 INTRODUCTION .............................................................................................................. 4
2 BACKGROUND ............................................................................................................... 5
2.1
Overview ................................................................................................................. 5
2.2
Features of CS5464 ................................................................................................ 5
2.3
Function diagram..................................................................................................... 6
3 HW DIAGRAM ................................................................................................................. 7
3.1
The HW diagram of energy measure ....................................................................... 7
4 HW REFERENCE SCH .................................................................................................... 8
5 FW DIAGRAM .................................................................................................................. 9
5.1
SPI Communication Process ................................................................................... 9
5.2
Firmware System Diagram .................................................................................... 10
6 FW FUNCTION LIST...................................................................................................... 11
6.1
API ........................................................................................................................ 11
6.2
HAL ....................................................................................................................... 12
7 ADDITIONAL INFORMATION ....................................................................................... 13
8 APPENDIX ..................................................................................................................... 14
8.1
List of Figures and Tables ..................................................................................... 14
MCU-AN-500120-E-10 – Page 3
CS5464 Operation V1.0.0
Chapter 1 Introduction
1 Introduction
This application note describes how to use One Phase Power Meter (CS5464) solution’s
energy measure chip-CS5464.
Chapter 2 explains the background of CS5464.
Chapter 3 explains the HW diagram of energy measure function.
Chapter 4 explains the HW reference SCH.
Chapter 5 explains the FW diagram.
Chapter 6 explains the FW function list.
MCU-AN-500120-E-10 – Page 4
CS5464 Operation V1.0.0
Chapter 2 Background
2 Background
Background of CS5464
2.1
Overview
The CS5464 is an integrated power measurement device which combines three ∆∑
analog-to-digital converters, power calculation engine, energy-to-frequency converter,
and a serial interface on a single chip. It is designed to accurately measure
instantaneous current and voltage and calculate VRMS, IRMS, instantaneous power,
active power, apparent power, and reactive power for high-performance power
measurement applications.
The CS5464 is optimized to interface to shunt resistors or current transformers for
current measurement, and to resistive dividers or potential transformers for voltage
measurement.
The CS5464 features a tamper detection scheme that uses the larger of the active
power measurements to register energy. Additional features include system-level
calibration, temperature sensor, voltage sag & current fault detection, and phase
compensation.
2.2
Features of CS5464

Energy Data Linearity: ±0.1% of Reading over 1000:1 Dynamic Range

On-chip Functions:
- Instantaneous Voltage, Current, and Power
- IRMS and VRMS, Active, Reactive, and Apparent Power
- Current Fault and Voltage Sag Detect
- System Calibrations / Phase Compensation
- Temperature Sensor
- Energy-to-pulse Conversion
- Positive-only Accumulation Mode

Meets Accuracy Spec for IEC, ANSI, & JIS

Low Power Consumption

Tamper Detection in 2-Wire Distribution Systems

GND-referenced Signals with Single Supply

On-chip 2.5 V Reference (25 ppm/°C typ)

Power Supply Monitor

Simple Three-wire Digital Serial Interface

“Auto-boot” Mode from Serial E2PROM

Power Supply Configurations: VA+ = +5 V; AGND = 0 V; VD+ = +3.3 V to +5 V
MCU-AN-500120-E-10 – Page 5
CS5464 Operation V1.0.0
Chapter 2 Background
2.3
Function diagram
Figure 2-1: The Function Diagram of CS5464
MCU-AN-500120-E-10 – Page 6
CS5464 Operation V1.0.0
Chapter 3 HW Diagram
3 HW Diagram
Hardware diagram of energy measure system
3.1
The HW diagram of energy measure
Voltage sample
Load Current sample
CS5464
Neutral Current sample
Figure 3-1: Hardware diagram
MCU-AN-500120-E-10 – Page 7
MB95F418
CS5464 Operation V1.0.0
Chapter 4 HW Reference SCH
4 HW Reference SCH
Hardware reference SCH of energy measure system
+5V
+5V
R85 5.1K
R69
10K
C42
R72
MSE_V1N
19
MSE_V2P
16
510R
1
2
C39
C44
103
4700p
MSE_V2N
15
C40
R77
C43
C35
1
2
100K
CS5464
TEST1
TEST2
VDD
8
R97
330R
WGND
PS2501-1
+5V
U21
MSE_SDO
1K
C52
13
14
1n
330R
GND
WGND
+5V
R71
VDD
330R
2
100KR79
GND
PS2501-1
104
R78 WGND
1K
1n
R96
R95
5.1R
U15
MSE_PF
PS2501-1
C45
103
R67
C34
1K
104
WGND
510R
+5V
R84
330R
GND
2
NA
GND
MSE_SDI
C53
WGND
103
R82
U22
R98
23
7
5
6
27
24
25
26
22
1
330R
WGND
1
510R
VREFIN
VREFOUT
DGND
12
11
PS2501-1
4
103
510R
R76
3
E1
E2
E3
2
3
VD+
IIN2-
WGND
R75
J8
IIN2+
AGND
LA
RESET
CS
SCLK
SDO
SDI
INT
IIN1-
17
J7
18
MODE
4700p
WGND
IIN1+
Y2
4.096MHz
4
103
28
1n
R92
1
Figure 4-1: RCS5464 Reference SCH
MCU-AN-500120-E-10 – Page 8
U16
4
C48
XIN
C51
GND
MSE_SCLK
3
20
1K
1
MSE_V1P
510R
XOUT
VIN-
R91
U20
2
10
330R
WGND
21
2
PS2501-1
3
R89
MSE_V3N
R81
PS2501-1
1
4700p
103
1n
+5V
PFMON
CPUCLK
510R
C47
1K
C46
1
R88
VIN+
R80
4
C49
VA+
9
MSE_V3P
WGND
2
104
4
10R
4
R94 150K
104
U18
MSE_RST
3
R93 150K
WGND
4
R87 150K
V_N
3
R90 150K
U19
2
R86 150K
C37
3
R83 150K
R70
1
+5V
WGND
C36
1
2
J4
PF CHECK
CS5464 Operation V1.0.0
Chapter 5 FW diagram
5 FW diagram
Firmware system diagram of energy measure system
5.1
SPI Communication Process
Figure 5-1: SPI Write Process
Figure 5-2: SPI Read Process
MCU-AN-500120-E-10 – Page 9
CS5464 Operation V1.0.0
Chapter 5 FW diagram
5.2
Firmware System Diagram
Start
Init Reg(CONFIG)
Init Reg(CYCLECOUNT)
Init Reg(PULSERATE)
Capture Active Pulse
Calc the energy based
on the EC
Light on the warning light
Deduct the charge
Balance <= 0
?
Balance <
warning
value?
Y
Y
N
N
End
Figure 5-3: Firmware System Diagram
MCU-AN-500120-E-10 – Page 10
Turn off the relay
CS5464 Operation V1.0.0
Chapter 6 FW Function List
6 FW Function List
6.1
API
Table 6-1: FW API List
Function Prototype
Description
void CS5464_Reg_Init(void)
Initialize CS5464 register
void EnergyCount_Init(void)
Initialize for energy counting
void AfeRefreshEnable(void)
AFE refresh enable
void AfeRefreshTask(void)
Refresh AFE setup with a reset and reconfiguration
void EnergyCount_Reset(void)
Reset all meter energy data
void CurEnergyCount_Reset(void)
Reset current meter energy data
void MeterKwhInc(void)
Accumulate meter KWH with each pulse
received
void PowerEnergy(void)
Accumulate energy pulses & output calibration
pulses
void GetMeterCurFwdEnergySum(INT8U *sumBuff)
Retrieve current sum of meter forward energy
data
void GetMeterCurRevEnergySum(INT8U *sumBuff)
Retrieve current sum of meter reverse energy
data
void GetMeterCurAllEnergySum(INT8U *sumBuff)
Retrieve current sum of meter total energy
data
void ReadMeterRuntimeData(void)
Read meter energy data saved in EEPROM
void SaveMeterRuntimeData(void)
Save meter energy data to EEPROM
void ReadMeterConst(void)
Read meter constant from EEPROM
void ReadMeterClibData(void)
Read meter clibration data from EEPROM
void SaveMeterClibData(void)
Write meter calibration data to EEPROM
void LoadTimeSegInfo(void)
Load or reset time-seg parameter in EEPROM
void UpdateTimeSegTable(INT8U tableId, INT8U segCount,
INT8U *segData)
INT8U FindTimeZoneSegTableSeriesId(INT8U idType)
Update time-seg table
INT8U FindTimeZoneSegTableId(INT8U idType)
Find a time-zone-ID and time-seg-table-ID
base on current calendar
INT8U FindTimeSegTariffId(INT8U hh, INT8U mm)
Find a time-seg tariff ID base on given time
value hh(hour) & mm(minute)
void ValidateTimeZoneId(void)
Validate time-zone ID base on current
calendar
void ValidateTimeSegTableId(void)
Validate time-seg table ID base on current
calendar
void SaveLastMonthAllEnergyCounter(void)
Save last month's all energy counter value to
EEPROM
void SaveLastMonthFwdEnergyCounter(void)
Save last month's forward energy counter
value to EEPROM
void SaveLastMonthRevEnergyCounter(void)
Save last month's reverse energy counter
value to EEPROM
void SaveCurrentEnergyCounter(void)
Save current energy counter value base on
Find a time-zone series ID base on current
calendar
MCU-AN-500120-E-10 – Page 11
CS5464 Operation V1.0.0
Chapter 6 FW Function List
tariff ID
void LoadEnergyCounter(void)
Load meter energy counter base on energy
direction state
void EnergyDirValidate(void)
Validate energy direction/state
void GetTimeSegFwdEnergySum(INT8U *sum, INT8U
monthId, INT8U segId)
Get forward energy sum for a specific time
segment
void GetTimeSegRevEnergySum(INT8U *sum, INT8U
monthId, INT8U segId)
Get reverse energy sum for a specific time
segment
void GetTimeSegAllEnergySum(INT8U *sum, INT8U
monthId, INT8U segId)
Get energy forward+reversed sum for a
specific time segment
void UpdateTimeSegTariffId(void)
Update tariff ID based on current time segment
INT32U GetVoltageRmsValue(void)
Get scaled voltage reading
INT32U GetLoadCurRmsValue(void)
Get scaled load current reading
INT32U GetNeutralCurRmsValue(void)
Get scaled neutral current reading
INT32U GetActivePowerValue(void)
Get scaled active power reading
INT32U GetPowerFactorValue(void)
Get scaled power factor reading
void ResetEnergyParameter(void)
Reset energy parameters
void Read_I_V_Energy(void)
Read AFE I/V energy data
void CS5464_StartConversion(INT8U mode)
CS5464 starts to conversion
6.2
HAL
Table 6-2: FW HAL List
Function Prototype
Description
void SPIPortInit(void)
Initialize SPI port
void BcdEnergySumIntInc(INT8U *bcd)
Increment a 4 byte BCD energy number by 1
from integer part(bcd[2])
void BcdEnergySumDecimalAcc(INT8U *bcd, INT8U
accVal)
void CS5464_ReadRegister(INT8U page, INT8U regAddr,
INT8U *buff)
INT8U SPI_ReadByte(void)
Accumulate a 4 byte BCD energy number
void CS5464_WriteRegister(INT8U page, INT8U regAddr,
INT8U *buff)
void SPI_SendByte(INT8U outDat)
Write CS5464 register value
void CS5464_WaitForReady(void)
CS5464 ready-status wait
INT8U CS5464_IsReady(void)
CS5464 ready-status check
void CS5464_SetRegPage(INT8U page)
CS5464 set register page for read/write
Read CS5464 register value
Byte in through SPI port
Byte out through SPI port
MCU-AN-500120-E-10 – Page 12
CS5464 Operation V1.0.0
Chapter 7 Additional Information
7 Additional Information
For more Information on FUJITSU semiconductor products, visit the following websites:
English version address:
http://www.fujitsu.com/cn/fsp/services/mcu/mb95/application_notes.html
Chinese version address:
http://www.fujitsu.com/cn/fss/services/mcu/mb95/application_notes.html
MCU-AN-500120-E-10 – Page 13
CS5464 Operation V1.0.0
Chapter 8 Appendix
8 Appendix
8.1
List of Figures and Tables
Table 6-1: FW API List ......................................................................................................... 11
Table 6-2: FW HAL List ........................................................................................................ 12
Figure 2-1: The Function Diagram of CS5464 ........................................................................ 6
Figure 3-1: Hardware diagram ............................................................................................... 7
Figure 4-1: RCS5464 Reference SCH ................................................................................... 8
Figure 5-1: SPI Write Process ................................................................................................ 9
Figure 5-2: SPI Read Process................................................................................................ 9
Figure 5-3: Firmware System Diagram ................................................................................. 10
MCU-AN-500120-E-10 – Page 14
Similar pages