AN230370 Precision analog channel subsystem in PSoC™ 4 HV PA family

About this document
Scope and purpose
This application note introduces you to the precision analog channel subsystem (PACSS) of PSoC™ 4 HV precision analog (PA) family MCUs. This application note also guides you to develop hardware and firmware design for battery monitoring application.
Intended audience
This document is intended for hardware and firmware design engineers.
Introduction
This application note provides an overview of the precision analog channel subsystem (PACSS) with the CY8C41xxLCE-HV4xx series from the PSoC™ 4 high-voltage (HV) precision analog (PA) family. PSoC™ 4 HV PA is a fully integrated programmable embedded system for battery monitoring and management. The system features an Arm® Cortex® M0+ processor and programmable and reconfigurable analog and digital blocks. To get a better understanding of the PACSS functionality and terminology used in this application note, it is a good idea to read "Section 21. Precision analog channel subsystem" of the
architecture reference manual (RM)
.
Precision analog channel subsystem overview
The PSoC™ 4 HV PA precision analog channel subsystem (PACSS) is a high-performance data acquisition subsystem consisting of two physical analog channels and four physical digital channels. The PACSS contains of the following blocks:
Analog delta-sigma modulator (DSM) system
Two analog channels
Channel multiplexer
Digital data system
Four digital channels (with/without FIR filter)
Data storage
Automatic gain control
Gain multiplexer
I/O components
Input multiplexer
Two high-voltage (HV) input dividers
On-die temperature sensor
External temperature sensor
shows the detailed block diagram of the PACSS measurement and acquisition system.
The analog DSM system is composed of the input multiplexer, programmable gain amplifier (PGA), anti-alias filter (AAF), diagnostic multiplexer, buffer, and a delta-sigma modulator. The digital data system is comprised of the scaler, decimator, FIR-type digital filter, accumulator, comparator, and offset and gain calibrations.
Also included in this subsystem are the auto gain correction (AGC) circuit and a temperature sensor with diagnostic capability. Each digital channel can quickly switch between input sources to create a "virtual" ADC that shares one of the analog channels, by using the digital data system. This “virtual” ADC channel can be used for diagnostic purposes.
The sequencer is used to generate control signals for performing all the functions of the channel.
Figure 1. PACSS measurement and acquisition system
Schematic and layout example
shows general schematic of external circuit for the PACSS system of the PSoC™ 4 HV PA MCU. See
AN230265 - Hardware design guide
for more information of power block.
Figure 2. General schematic of external circuit for PACSS system

Current sensor line
Schematic example
The current sensor line uses the RSH/RSL and RSH2/RSL2 terminals of the PSoC™ 4 HV PA MCU (See
Figure 3
). The RSH/RSL terminals are for the main line, and the RSH2/RSL2 terminals are for diagnostics. In the circuit example below, the sense output of one shunt resistor is routed to both RSH/RSL and RSH2/RSL2 terminals.
The external resistor and capacitor are optional low-pass filter components to attenuate any external noise for your application.
shows an example of external components.
Figure 3. Schematic example of current sensor line

Symbol | Overview | Parameter | ||
---|---|---|---|---|
Value 1 | Value 2 | Remark | ||
R1, R3, R4, R6 | Resistor for external noise filter | 56 Ω ± 1% | > 1/10 W | |
C1, C7 | Capacitor for external noise filter | 22 nF X7R | > 50 V | |
C2, C8 | Capacitor for external noise filter | 47 pF C0G | > 50 V | |
C14, C15, C16, C17 | Capacitor for external noise filter | 0.01 μF X7R | > 50 V |
Note: Max resistor value for current path (R1/R3/R4/R6): 500ohm.
Layout example
shows an example of current sensor line layout. Note that RSH2/RSL2 components are placed on bottom layer which are same position as RSH/RSL. This figure only shows top layer.
Figure 4. Layout example of current sensor line
Follow these guidelines for the design of the current sensor line circuit on the PSoC™ 4 HV PA MCU:
Match the length of each pair of RSHx and RSLx traces by routing on top or bottom layers of the PCB
Keep the width of RSHx/RSLx traces as the same as the IC Pad width
Do not use through-hole vias on the RSH/RSL trace if possible
Connect shunt resistor tracks from the inner edges of its solder pad to the IC as a differential pair
Keep the distance between RSHx and RSLx traces as the same as the IC terminal pitch if possible
Guard the entire pattern with GND
Place the GND layer under the sensor lines
Voltage sensor line
Schematic example
The voltage sense line uses the VSENSE and VDIAG terminals of the PSoC™ 4 HV PA MCU (See
Figure 5
). The VSENSE terminal is for the main line, while the VDIAG terminal is for diagnostic. In the circuit example below, the battery voltage input (VBAT) is divided into two and input to each terminal.
VSENSE and VDIAG inputs are normally connected directly to the battery with a series 2.2-kΩ resistor to measure the battery voltage; the capacitors are for low-pass filtering. The external transient voltage suppressors (TVS) diodes are to protect ESD noise. The TVS diodes are optional components.
shows an example of external components.
Figure 5. Schematic example of voltage sensor line

Symbol | Overview | Parameter | ||
---|---|---|---|---|
Value 1 | Value 2 | Remark | ||
R5, R7 | Resistor for external noise filter | 2.2 kΩ ± 1% | > 1/10 W | |
D3, D4 | Transient voltage suppressor (TVS) | Bidirectional | Clamping voltage 44 V | Optional |
C9, C19 | Capacitor for external noise filter | 3.3 nF X7R | > 50 V | |
C10, C20 | Capacitor for external noise filter | 47 pF C0G | > 50 V |
Note: Resistor values for voltage path (R5/R7): any deviation from nominal 2.2 kilohm needs to be associated with a reduction in accuracy.
Layout example
shows an example of the voltage sensor line layout.
Figure 6. Layout example of voltage sensor line
Follow these guidelines for the design of voltage sensor line circuit on the PSoC™ 4 HV PA MCU:
Length match the VSENSE and VDIAG traces as close as possible
Wire the VSENSE and VDIAG sensor lines from each VBAT point
Keep the trace width in the range of "0.127 mm" to the "IC terminal width"
Guard the entire pattern with GND
Place the GND layer under the sensor line
Temperature sensor line
Schematic example
The temperature sensor line uses the VTEMP_SUP, VTEMP, and VTEMP_RET terminals of the PSoC™ 4 HV PA MCU (See
Figure 7
). VTEMP_SUP terminal is the power supply for the external temperature sensor, VTEMP is the temperature voltage input from the external sensor, and VTEMP_RET is the ground signal. In the circuit example below, the capacitors are added for decoupling the temperature sensor line.
The external voltage divider is selected to optimize temperature accuracy and will typically be comprised of a 33-kΩ and 16.9-kΩ fixed resistors (R) and a 10-kΩ nominal NTC thermistor RT (nominal NTC resistance is typically specified at 25°C).
shows an example of external components.
Figure 7. Schematic example of temperature sensor line

Symbol | Overview | Parameter | ||
---|---|---|---|---|
Value 1 | Value 2 | Remark | ||
R8 | Resistor for voltage divider | 33 kΩ ± 1% | > 1/10 W | |
R10 | Thermistor | 10 kΩ ± 1% | > 1/8 W | |
R11 | Resistor for voltage divider | 16.9 kΩ ± 1% | > 1/10 W | |
C23 | Capacitor for external noise filter | 0.15 μF X7R | > 10 V |
Layout example
shows an example of temperature sensor line layout.
Figure 8. Layout example of temperature sensor line
Follow these guidelines for the design of temperature sensor line circuit on the PSoC™ 4 HV PA MCU:
Place the thermistor (R10) as close to hot spot as possible
Keep the VTEMP_SUP, VTEMP, and VTEMP_RET at the same length as possible
Place the filter capacitor (C24) near the VTEMP and VTEMP_RET terminal
Keep the trace width in the range of "0.127 mm" to "IC terminal width"
Guard the entire pattern with GND
Place the GND layer under the sensor line
Battery minus and chassis GND connection
The PSoC™ 4 HV PA MCU can connect a battery minus and chassis GND to each current sensor line (RSH/RSL) and silicon GND (VSSA).
Figure 9
shows the general application block diagram for the intelligent battery system.
This example connects RSH and VSSA to chassis GND and connects RSL to battery minus. In this case, PACSS output will be #1 results in
Table 4
. The output data includes the consumed current of the PSoC™ 4 HV PA board as shown in green (when VSSA connects chassis GND). The polarity will be positive when discharging the battery and negative in charging the battery (When RSH is connected to chassis GND).
User can select the suitable GND connection for your application from
Table 4
.
Figure 9. General application block diagram for intelligent battery system
GND connection | Block diagram | PACSS output | ||
---|---|---|---|---|
Polarity | Data | |||
1 | RSL - Battery minus RSH - Chassis GND VSSA - Chassis GND | Discharge: Plus Charge: Minus | Includes the consumed current of the PSoC™ 4 HV PA board | |
2 | VSSA - Battery minus RSL - Battery minus RSH - Chassis GND | Discharge: Plus Charge: Minus | Does not include the consumed current of the PSoC™ 4 HV PA board | |
3 | VSSA - Battery minus RSH - Battery minus RSL - Chassis GND | Discharge: Minus Charge: Plus | Does not include the consumed current of the PSoC™ 4 HV PA board | |
4 | RSH - Battery minus RSL - Chassis GND VSSA - Chassis GND | Discharge: Minus Charge: Plus | Includes the consumed current of PSoC™ 4 HV PA board |
PACSS firmware configuration
Infineon provides the sample driver library (SDL) including startup code as sample firmware. The SDL provides a simple interface to access various peripherals and is used for system validation, hardware bring-up, benchmarks, feasibility studies, and demos. The SDL cannot be used for production purposes because it is not qualified with any automotive standards. The SDL integrates device header files, startup code, and peripheral drivers. The SDL contains a set of firmware drivers that provide APIs for accessing device-specific resources. See
AN230264 - Getting started with PSoC™ 4 HV PA family
for detailed SDL information.
The following sections explain the details of the application programming interface (API) and code examples for PACSS.
Attention: PACSS firmware configuration is created based on SDL version 3.0.0.
Peripheral drivers
Peripheral drivers are a set of firmware drivers that provide APIs for accessing the hardware. These APIs perform initialization and control activities of each peripheral.
Table 5 lists and describes the interface to each PACSS function. The peripheral drivers of PACSS are located in SDL path of:
C:/<user path>\ PSoC_Sample_Driver_Library_x.x.x\psoc4hvXXXk\src\drivers\adc\rev_b
Note: The PACSS has many registers to configure it. Table 5 is simplifying to only expose controls the customer should be using. See "low_level" and "config" folders in above path for more detailed functions.
See
API details
for more information.
Function | Description |
---|---|
cy_adc.c | |
Cy_Adc_StartConversion() | Trigger a conversion on the enabled primary channels |
Cy_Adc_StartSecondaryConversion() | Trigger a secondary conversion on the enabled secondary channels |
Cy_Adc_GetResult() | Read the value in the result register of the specified channel |
Cy_Adc_GetAccumulatorResult() | Read the value in the accumulated result register of the specified channel |
Cy_Adc_ResetAccumulator() | Reset the accumulator to zero |
Cy_Adc_SetAccumulatorThreshold() | Set the accumulator Threshold |
Cy_Adc_SetGroundReference() | Set the ground connection for the high-voltage divider |
Cy_Adc_EnableSequencer() | Enable the ADC sequencer and AREF |
Cy_Adc_DisableSequencer() | Disable the ADC sequencer |
Cy_Adc_EnableReference() | Configure and enable the high-precision band gap reference (HPBGR) |
Cy_Adc_DisableReference() | Disable the high-precision band gap reference (HPBGR) |
Cy_Adc_GetInterrupt() | Get the specified digital channel's interrupt status |
Cy_Adc_GetInterruptMasked() | Get the DCHAN interrupt status masked by the enabled interrupts |
Cy_Adc_SetInterruptMask() | Enable the specified interrupt type for the specified channel |
Cy_Adc_ClearInterrupt() | Clear the specified interrupt |
Cy_Adc_GetInterruptCause() | Get the interrupt cause |
Cy_Adc_SetGainCorrection() | Set the gain correction factor for the specified DCHAN |
Cy_Adc_SetOffsetCorrection() | Set the offset correction factor for the specified DCHAN |
Cy_Adc_SetAGCGainCorrection() | Set the gain correction factor for the specified AGC gain level |
Cy_Adc_SetAgcOffsetCorrection() | Set the offset correction factor for the specified AGC gain level |
Cy_Adc_SetVrefLow() | Set the selection of the low reference of the DCHAN |
Cy_Adc_SetVrefHigh() | Set the selection of the high reference of the DCHAN |
cy_adc_init_achan.c | |
Cy_Adc_EnableAchan() | Enable the analog channel |
Cy_Adc_DisableAchan() | Disable the analog channel |
Cy_Adc_InitAchan() | Configure the analog channel |
ConfigureBuffer() | Configure the analog channel buffer |
ConfigurePga() | Configure the analog channel programmable gain array |
ConfigureReference() | Configure the analog channel reference |
ConfigureModulator() | Configure the analog channel modulator |
ConfigureTrigger() | Configure the analog channel primary/secondary trigger |
cy_adc_init_agc.c | |
Cy_Adc_EnableAgc() | Enable automatic gain correction (AGC) |
Cy_Adc_DisableAgc() | Disable automatic gain correction (AGC) |
Cy_Adc_InitAgc() | Configure automatic gain correction (AGC) |
ConfigureGainLevel() | Configure the gain level in memory, given the input configuration |
cy_adc_init_channel_chopping.c | |
Cy_Adc_InitAchanChannelChopping() | Configure the selected analog channel to perform channel chopping. |
cy_adc_init_dchan.c | |
Cy_Adc_EnableDchan() | Enable the digital channel |
Cy_Adc_DisableDchan() | Disable the digital channel |
Cy_Adc_InitDchan() | Configure the digital channel |
Cy_Adc_ConfigureGainLevel() | Configure the digital channel gain level settings |
ConfigureFIRFilter() | Configure the digital channel FIR filter coefficients |
Cy_Adc_ConfigureAafMode() | Configure the anti-alias filter |
cy_adc_init_temperature.c | |
Cy_Adc_EnableTemperature() | Enable the temperature sensor |
Cy_Adc_DisableTemperature() | Disable the temperature sensor |
Cy_Adc_InitTemperature() | Configure the temperature sensor |