Abov A31L12X Installation and operating instructions

Contents/ List of Figures 32-bit MCU Current Sensing Board Design Guide
2
Contents
1Introduction ....................................................................................................................................3
2Current Sensing Board Block Diagram ..........................................................................................4
3Hardware Description: Parts and Circuits ......................................................................................5
3.1 Current-Sense Amplifier (INA190).......................................................................................5
3.2 24-Bit Analog to Digital Converter (LTC2400) .....................................................................8
3.3 LCD Module and Interfaces ..............................................................................................10
4Software Structure .......................................................................................................................12
4.1 State Machine Structure....................................................................................................12
4.2 State Machine Software Code ..........................................................................................13
4.3 24-bit ADC Communication Software Code ......................................................................16
5Quick Start Guide: Setup and Use...............................................................................................18
5.1 Current Sensing Evaluation Board....................................................................................18
5.2 Example Firmware Project Compiling and Downloading ..................................................19
5.3 How to use Current Measurement Board .........................................................................21
5.4 Example Circuit Diagram and Firmware Source for Current Sensing Board....................23
6Conclusion ...................................................................................................................................26
7References...................................................................................................................................27
Revision History ....................................................................................................................................28
List of Figures
Figure 1. Functional Block Diagram ........................................................................................................4
Figure 2. Current Sense Amplifier (INA190) Block Diagram...................................................................5
Figure 3. Current Sense Amplifier Circuit Layout Example.....................................................................7
Figure 4. 24-bit ADC (LTC2400) Block Diagram .....................................................................................8
Figure 5. Internal SCK, SPI Comm. Operation 24-bit ADC (LTC2400)...................................................9
Figure 6. 4-Digit LCD Panel (GDC8310)...............................................................................................10
Figure 7. Connections Circuit Diagram of A31L12X and 4-Digit LCD Panel ........................................11
Figure 8. Current Measurement State Machine Diagram .....................................................................12
Figure 9. Function Declaration using Function Pointers .......................................................................13
Figure 10. Example Code 1/2 showing StateMachine Function Structure ...........................................14
Figure 11. Example Code 2/2 showing StateMachine Function Structure............................................15
Figure 12. 24-bit ADC (LTC2400) SPI Comm. Operation Code and Waveforms .................................16
Figure 13. Current Sensing Evaluation Board ......................................................................................18
Figure 14. Example Project Folder Directory ........................................................................................19
Figure 15. Example Project Configuration (main.c, main_conf.h) ........................................................19
Figure 16. Current Sensing Board Connections ...................................................................................21
Figure 17. Example Circuit Diagram of Current Sensing Board (1)......................................................23
Figure 18. Example Circuit Diagram of Current Sensing Board (2)......................................................24

32-bit MCU Current Sensing Board Design Guide 1. Introduction
3
1Introduction
A31L12X Current Sensing Board Design Guide introduces a method to design a current sensing board
using an A31L12X that is a 32-bit Ultra-Low Power MCU. This document intends that users should
design the current sensing board to measure the operating current of an application board having
A31L12X and check the operating current of the A31L12X.
The Ultra-Low Power MCU A31L12X reduces the operating current by utilizing DEEP-SLEEP mode.
During DEEP-SLEEP mode, it consumes about 1uA with 3V power source. For detailed information of
A31L12X specification, please refer to 23.11 Supply Current Characteristics in A31L12X User’s Manual.
To measure the current in uA unit on the Current Sensing Board, a high precision 24-bit ADC and a
high precision Current Sense Amplifier are used. This document describes how to use them.
In addition, more materials and corresponding solutions of hardware and software that are required for
the Current Sensing Board design are provided with this document.

32-bit MCU Current Sensing Board Design Guide 3. Hardware Description: Parts and Circuits
5
3Hardware Description: Parts and Circuits
In Chapter 3, parts and circuits of the Current Sensing Board are introduced.
3.1 Current-Sense Amplifier (INA190)
The Current-Sense Amplifier (INA190), also called a current-shunt monitor, is commonly used for the
precision current measurement. It can correctly measure the current using a small Shunt (sensing)
resistor, while consuming low power.
For detailed information of this part, please refer to INA190 Technical Document.
Figure 2. Current Sense Amplifier (INA190) Block Diagram
Figure 2 shows a basic circuit configuration of the Current-Sense Amplifier. Users who use this part for
circuit designs need to consider the followings:
1. It can be applied only for one-way of the current that is measured in the circuit. Please refer to
the INA190 Technical Document for the two-way application.
2. The most important thing is that a Current Sense Resistor and the INA190 must be closely
arranged, and input pin (IN+ and IN-) and the Current Sense Resistor are connected using
Kelvin Connection.

3. Hardware Description: Parts and Circuits 32-bit MCU Current Sensing Board Design Guide
6
3. Users need to determine the range of the current to sense before selecting the resistor value
of Rsense and the INA190 GAIN.
①Using two formulas, example values of the Rsense and INA190 Gain are determined:
▪ is the maximum allowable power dissipation in .
▪
is a supply voltage, output limitations that is the gained up voltage difference
from the IN- to the IN- pins.
▪ is the gain of the Current-Sense Amplifier.
②If users determine the range of the current to measure from 0uA to 100uA and set the
values as follows,
▪ = 100uA, = 0.5W,
= 3.3V, GAIN = 500
the resistor value of Rsense is calculated as < 66Ω.
As a result, the Current Sensing Board for uA measurement uses a resistor of 50Ω.
③If users determine the range of the current to measure from 0mA to 100mA and set the
values as follows,
▪ = 100mA, = 0.5W,
= 3.3V, GAIN = 50
the resistor value of Rsense is calculated as < 0.66Ω.
As a result, the Current Sensing Board for mA measurement uses a resistor of 0.5Ω.
④For the example of ②, output ranges from 0V to 2.5V and has 25mV resolution per 1uA.
For the example of ③, output ranges from 0V to 2.5V and has 25mV resolution per 1mA.
Therefore, the Current Sensing Board needs an ADC having 16-bit or more accuracy for
the precision current sensing.
⑤As explained through ①to ④, values of Rsense and INA190 GAIN are determined
according to the current range that is to be measured.

32-bit MCU Current Sensing Board Design Guide 3. Hardware Description: Parts and Circuits
7
4. The one-way application of the INA190 described in step 1 has the following layout guideline:
①As shown in Figure 3, a bypass capacitor of the power source must be placed close to
the power and ground pin of the INA190. The value of the bypass capacitor is
recommended as 0.1uF.
②The impedance generated in the wiring is minimized when the connection length between
IN+/ IN- and the Current Sense Resistor is short.
③To reduce the current measurement error, the Current Sense Resistor and the Input (IN+/
IN-) are connected using Kelvin Connection or 4-wire Connection.
Figure 3. Current Sense Amplifier Circuit Layout Example

3. Hardware Description: Parts and Circuits 32-bit MCU Current Sensing Board Design Guide
8
3.2 24-Bit Analog to Digital Converter (LTC2400)
The 24-bit Analog to Digital Converter is used to convert the precision analog voltage signal to digital
signal. Small voltage signal across the small Shunt (Sensing) resistor is sensed to measure the exact
micro current.
For detailed information of this part, please refer to LTC2400 Technical Document.
Figure 4. 24-bit ADC (LTC2400) Block Diagram
Figure 4 shows a basic circuit configuration of the 24-bit ADC. Users who use this part for circuit designs
and software (SPI communication) configuration need to consider the followings:
1. A bypass capacitor of 1uF should be placed close to the power supply unit.
2. The reference voltage range of the ADC can be determined by using VREF. If users want the
input range of the ADC from 0V to 3.3V, users need to apply the VREF = 3.3V.
3. F0in Figure 4 can be used with 3 alternative functions. In the example circuit in Figure 4, F0is
connected to GND to use an internal OSC of the LTC2400 and a notch filter of 60Hz.

32-bit MCU Current Sensing Board Design Guide 3. Hardware Description: Parts and Circuits
9
4. The LCD2400 SPI control has the following guidelines:
①If using the internal OSC option, the SCK is used as a digital output pin, and external pull-
up resister of 10kΩis required (in the example circuit, MCU internal pull-up mode is used).
②For the case of using the internal OSC option, SPI communication operation of the internal
SCK is described in Figure 5.
Figure 5. Internal SCK, SPI Comm. Operation 24-bit ADC (LTC2400)
③When using the internal SCK, the SCK of the LTC2400 is digital output, and the MCU
(A31L12X) becomes Slave to receive the SCK as its Input.
④When using the internal SCK, the SDO of the LTC2400 is digital output, and the MCU
(A31L12X) becomes Slave to receive the ADC data through the MOSI pin.
⑤On the other hand, the CS of the LTC2400 is input and the MCU (A31L12X) becomes
Master. Its output signal controls specific timing and allows to start communication through
the SCK and SDO of the LTC2400.
⑥In Figure 5, if CS turns to LOW, data that ADC completes to convert is transmitted through
the SCK and SDO.
⑦In Figure 5, BIT 28 to Bit 31 of the SDO data format indicate ADC status, and BIT 4 to BIT
27 are 24-bit ADC’s converted value. BIT 27 is the MSB and BIT 4 is the LSB.

3. Hardware Description: Parts and Circuits 32-bit MCU Current Sensing Board Design Guide
10
3.3 LCD Module and Interfaces
The LCD module and interfaces are used for confirming the control operation and checking output
values.
The LCD module uses 4-digit 7-segment LCD to display the measured current value in uA or mA units
including decimal points. The interfaces such as button that can start or stop the current measurement
is provided for the users to control the current measurement. For detailed information of the LCD part,
please refer to GDC8310 Technical Document.
The LCD module and interfaces are free to change for many different applications. Examples are
introduced in this section.
Figure 6. 4-Digit LCD Panel (GDC8310)

32-bit MCU Current Sensing Board Design Guide 3. Hardware Description: Parts and Circuits
11
Figure 6 shows a basic circuit configuration of the LCD module. Users who use this part for LCD control
need to consider the followings:
1. The LCD module in Figure 6 can be controlled by using LCD driver peripherals of A31L12X.
2. The GDC8310 operates with 3.3V of operation voltage and uses 1/4 Duty 1/3 Bias drive
techniques.
3. Each of COM and SEG of A31L12X and GDC8310 can be connected by matching them as
shown in Figure 7.
Figure 7. Connections Circuit Diagram of A31L12X and 4-Digit LCD Panel
Finally, a button is added to start or stop the current sensing measurement. For detailed information of
the control method, please refer to example code in Chapter 4.

4. Software Structure 32-bit MCU Current Sensing Board Design Guide
12
4Software Structure
In Chapter 4, knowledge that software developers must have is described. Figure 8 shows a State
Machine diagram of the software that drives the Current Sensing Board.
OFF
STOP Current Measurement
ON
Start Current Measurement
for 5 seconds
Process
Start Current Measurement
continuously
"Click Button"
"5 seconds later"
OR
"Click Button"
"Click Button"
"Long Button"
Figure 8. Current Measurement State Machine Diagram
4.1 State Machine Structure
Example software in this chapter is designed in a form of State Machine shown in Figure 8:
1. The State Machine consists of Function Pointers, and each of them points to executable code
in each State.
2. An event that changes the current State is generated by a button.
3. The State Machine operates as follows:
—At first on OFF State, if pressing the button, the current State changes to On State.
—If pressing the button for a long period, the current State changes to Process State.
—During On State, Current Sensing is executed for 5 seconds. If pressing the button within
5 seconds, the current State changes to Off State to stop the Current Sensing.
4. During Process State, the State Machine proceeds the Current Sensing and displays the
measurement in real-time. If pressing the button, the measurement stops.
5. Users are free to modify the Structure of the State Machine, and add events.

32-bit MCU Current Sensing Board Design Guide 4. Software Structure
13
4.2 State Machine Software Code
Figure 9. Function Declaration using Function Pointers
Figure 9 shows an example code of function declarations that use Function Pointers.
1. UponEnter[S_MAX] includes functions executed when the current State changes (entering
new State) due to the event occurrence such as button-pressing.
2. ActionWhileInState[S_MAX] includes functions executed after the UponEnter functions.
Without special events, it continues to execute.
3. UponExit[S_MAX] includes functions executed when the current State changes (exiting the
current State) due to the event occurrence such as button-pressing.
4. Users can modify the code by adding more functions.

4. Software Structure 32-bit MCU Current Sensing Board Design Guide
14
Figure 10. Example Code 1/2 showing StateMachine Function Structure
Figure 10 shows the first half of example code that is implemented in the StateMachine function. The
example code operates as follows:
1. When the StateMachine function is called, the event and current State is stored as parameters.
2. During the current State, next State is set according to the event. For example, when the
current State is S_OFF, if a button is pressed, an event = E_ON and Next_State = S_ON.
3. The event is classified by the length how long it is pressed.

32-bit MCU Current Sensing Board Design Guide 4. Software Structure
15
Figure 11. Example Code 2/2 showing StateMachine Function Structure
Figure 11 shows the second half of example code that is implemented in the StateMachine function.
The example code operates as follows:
1. According to the current State and next State processed in the first half of the example code,
functions to be called are determined.
2. If the current State and next State are different each other, a function in the UponExit of the
current State is called and a function in the UponEnter of the next State is called in turn.
3. If the current State and next State are the same each other, functions in the ActionWhileInState
of the current State are called continuously by default.
—Example) The current State and next State are S_ON, functions in the ActionWhileInState
(current measurement code) are executed for 5 seconds and terminated.
4. Users are free to modify the Structure of the State Machine, and add events.

4. Software Structure 32-bit MCU Current Sensing Board Design Guide
16
4.3 24-bit ADC Communication Software Code
Figure 12 shows an example software code that intends to communicate with the 24-bit ADC shown in
Figure 5.
Figure 12. 24-bit ADC (LTC2400) SPI Comm. Operation Code and Waveforms
1. If the MCU sets the CS pin to LOW, the ADC outputs through the SCK and SDO (always to
LOW).

32-bit MCU Current Sensing Board Design Guide 4. Software Structure
17
2. To receive ADC 32-bit data consecutively, the level state of the SDO is read by using the GPIO
external interrupt at Positive Edge (see the above example code in Figure 12).
3. When spi_data fills up the 32-bit length, BIT 4 to BIT 27 that are corresponding to the 24-bit
ADC data is converted to 24-bit data by bit masking.

5. Quick Start Guide: Setup and Use 32-bit MCU Current Sensing Board Design Guide
18
5Quick Start Guide: Setup and Use
In Chapter 5, users can learn how to setup and use the Current Sensing Board that is designed using
the example code of Chapter 4.
5.1 Current Sensing Evaluation Board
Figure 13. Current Sensing Evaluation Board
The hardware on the Current Sensing Evaluation Board shown in Figure 13 is as follows:
1. An LCD module and current sensing input terminals N and P
2. A button controlling the start and termination of the current measurement
3. An input terminal dedicated to a 9V voltage battery
4. A terminal for the MCU (A31L12X) download and debugging (SWD). Please refer to the pin
map in red box next to Debugger terminal in Figure 13.
5. A terminal for MCU (A31L12X) UART communication. It is used for the debugging and test.

32-bit MCU Current Sensing Board Design Guide 5. Quick Start Guide: Setup and Use
19
5.2 Example Firmware Project Compiling and Downloading
In this section, users can learn a method to compile, debug, and download an example firmware project.
Figure 14. Example Project Folder Directory
Figure 15. Example Project Configuration (main.c, main_conf.h)
Following is the description of the folder directory and project menus of the example project shown in
Figure 14 and Figure 15:
1. Go to the location shown in Figure 14:
A31L12x_Current_Sensing_Example\Examples\CURRENT_SENSING\
Current_Sensing_Example\KEIL\
①Open the Current_Sensing.uvprojx file in the location.
②Execute Keil uVision.
2. Before starting the project compilation shown in Figure 15, set the UNIT_MODE on the 47th
line of the main_conf.h file according to the measurement unit.
—If the UNIT_MODE is set to 0, the measurement unit is uA while if the UNIT_MODE is set
to 1, the measurement unit is mA.

5. Quick Start Guide: Setup and Use 32-bit MCU Current Sensing Board Design Guide
20
3. Click on the icon 1 shown in Figure 15 to start compilation.
4. When the compilation is completed, connect to the debugger terminal on the example board.
5. Click on the icon 2 shown in Figure 15 to start firmware download.
6. Information of the debugger terminal is available in 5.1 Current Sensing Evaluation Board.
Table of contents
Other Abov Computer Hardware manuals
Popular Computer Hardware manuals by other brands

Roland
Roland House Collection SR-JV80-19 owner's manual

5G HUB
5G HUB BG77 USB manual

ekwb
ekwb EK-FC R9-290X Backplate INSTALLATION AND MOUNTING MANUAL

Ashly
Ashly Protea WR-1 release note

National Instruments
National Instruments PC-LPM-16/PnP user manual

Avalue Technology
Avalue Technology SID-10W03 Quick reference guide