Sunday, August 25, 2013

Shift Register and Feedback Node


Shift Register and Feedback Node have the similar function that  is used to store the data after execute the loop and transmit to next loop.

(Fig 1: Feedback node)

(Fig 2: Shift Register)

The result is the same, but Shift Register (Fig 2) has 3 store units.


(Fig 3: Feedback node with initializer one loop out)

But the shift register is faster than feedback node much. Compare the execute time by below code.
(Fig 4: Feedback node with timer--3301 mSec)

(Fig 5: Shift Register with timer--2698 mSec)



Any questions or technical discussion, please reach at support@itestgroup.com, and more detail click here

Monday, August 12, 2013

电容降压的工作原理、计算以及注意事项

电容降压的工作原理、计算以及注意事项

电容降压

1、工作原理

电容降压是利用电容在一定的交流信号频率下产生的容抗来限制最大工作电流。在理想电容器上并不产生功耗,如果电容是一个理想电容,则流过电容的电流为虚部电流,它所作的功为无功功率。根据这个特点,我们如果在一个电容器上再串联一个阻性元件,则阻性元件两端所得到的电压和它所产生的功耗完全取决于这个阻性元件的特性。因此,电容降压实际上是利用容抗限流。而电容器实际上起到一个限制电流和动态分配电容器和负载两端电压的角色。电容降压具有功耗低,成本低等优点。当然缺点也有,缺点在后面的注意事项中说明。

2、容抗计算

Xc = 1/(ω*C)= 1/(2*π*f*C);

Xc--------电容容抗值;欧姆

ω---------角频率

π---------3.14;

f---------频率,对工频是50HZ;

C---------电容值 法拉

本设计即采用C12与C15进行分压,大部分电压降落在C15两端。现在计算分压情况

Xc15=(1/(2*∏*50*470))*1000000000=6.772KΩ

Xc12=(1/(2*∏*50*10))*1000000000=318KΩ

先计算后仿真

…………(待补充)

3、注意事项

(1)未和220V交流高压隔离,请注意安全,严防触电!

(2)限流电容必须采用无极性电容,须接于火线,耐压要足够大(大于400V),并加串防浪涌冲击兼保险电阻和并放电电阻。

(3)注意齐纳管功耗,严禁齐纳管断开运行。

(4)根据负载的电流大小和交流电的工作频率选取适当的电容,而不是依据负载的电压和功率。

(5)电容降压不能用于大功率条件,一般在100mA下使用,因为不安全。

(6)电容降压不适合动态负载条件,电容降压不适合容性和感性负载。

(7)当需要直流工作时,尽量采用半波整流。不建议采用桥式整流。而且要满足恒定负载的条件。

单片机系统中的掉电检测与数据存储问题


下面是我在电能表系统中的方案与分析:
2.掉电检测与数据存储
1)总体思路
由于电能表的计量是要求持续性的,而主供电系统不可能是持续的,注意这里需要一个掉电检测与数据存储的问题。首先检测出供电系统已经断电,然后启用备用电源存储数据,而且数据必须存储在掉电不易失的存储器(如EEPROM,FLASH等)中。
本应用中,需要检测出掉电后备用电源能提供足够的电能供单片机进行数据存储。总体思路,本应用中单片机采用的是STC89C58RD+,单片机内部已经集成了16K的EEPROM,所以不需要另外外接存储器。ADE7755已经自带了电源监控功能,前面的ADE7755的介绍中已经有所描述,所以亦无须担心。这里只需要解决好单片机的掉电问题即可。在系统的稳压前端设置监测点,当监测点的电压下降到另一个基准比较电压时产生单片机外部中断。当单片机接收到外部中断后启动数据存储程序,将数据存储到片内EEPROM内。当主供电系统恢复供电后,单片机首先读取EEPROM数据,然后再恢复计数。
2)掉电检测
有电压采集转换、电压比较等方案。经过综合考虑,这里采用LM393比较器来对比监测点与参考点电压,一旦监测点电压降到某种程度,比较器就会有高电平输出,由此产生单片机外部中断。
另外有一种反其道而行之的方案。在降压后的交流端加一个光耦产生中断,一旦中断消失程序转向数据存储。
3)备用电源
虽然备用电源可以采用可充电电池,大电容等方案,但由于这里所需要的电量并不是很大,持续时间也不需要很长,只需要能完成数据存储即可。所以这里选择了大电容作为备用电源这一方案。选择了在稳压后端与单片机电源端直接并联了两个达3300uF的大容量电解电容。同时,为安全起见,在单片机的电源输入端还串入了一个低正向压降压降的二极管来阻止大电容向除单片机意外的其他电路放电。
4)数据存储
不可易失存储方案很多,比如EEPROM,FLASH,铁电等。但Flash读写比较麻烦,铁电也需要另加外围器件,所以这里选择单片机内置的EEPROM无疑是最好的选择。不仅读写简单方便,可多次擦写,减少外围器件与单片机IO口,而且为备用电源减轻了很大的负担。
最后,需要说明的是,实际上现在很多高档单片机已经集成上述功能。比如AVR自带的BOD(Brown-out Detection)电路,内置模拟比较器,C8051F系列自带AD而且在掉电时自动产生中断。也有独立的专用复位芯片,如TPS3705,ISL88706等。
5)理论计算
(1)按恒流充放电的简化计算:Q = CV = IT.Q是电量,C是电容量,V是电压,I是电流,T是时间
那么T=CV/I,在本例中可以估算时间为 T= 0.0033f*(5.0V-3.8V) / 0.012A = 0.33s,即330ms. 330/8.5 = 38.8mS,即最多可以保存38字节数据到EEPROM中,38字节对于本应用已经足够。
数据说明:
单片机在3.8V到5.5V之间工作正常;单片机的工作电流典型值是4mA;最大工作电流20mA;普通外置EEPROM的读写一个字节的时间是8.5mS左右。据下面引述资料显示,此计算是保守估算,故可靠性有所保证。
STC单片机datasheet上是这样描述的:
1.同一次修改的数据放在同一扇区中,不是同一次修改的数据放在另外的扇区,就不须读出保护。2.如果一个扇区只用一个字节,那就是真正的EEPROM,STC 单片机的Data Flash 比外部EEPROM 要快很多,读一个字节/ 编程一个字节大概是0.2uS/60uS。3.如果在一个扇区中存放了大量的数据,某次只需要修改其中的一个字节或一部分字节时,则另外的不需要修改的数据须先读出放在STC单片机的RAM中,然后擦除整个扇区,再将需要保留的数据和需修改的数据一并写回该扇区中。这时每个扇区使用的字节数是使用的越少越方便(不需读出一大堆需保留数据)。

Thursday, July 25, 2013

[worklog] miss the TestStand vi, named "Close Termination Monitor.vi" etc


Background
Test team report that software can't run normally, after check the software and find that miss 3 subVIs and 1 custom-control.

• TestStand - Initialize Termination Monitor.vi
• TestStand - Get Termination Monitor Status.vi
• TestStand - Close Termination Monitor.vi

These 3 VIs locate in system folder, under ...Addon/<TestStand>...
Why miss these 3 system VIs? 
When install the TestStand and LabVIEW at the same PC, must follow the correct order. Install LabVIEW at first, and then TestStand.

Reference:
1.http://forums.ni.com/t5/LabVIEW/Missing-Teststand-Vi-s-with-new-Labview-Teststand-install/m-p/1597348
2.http://www.ni.com/pdf/manuals/373200b.pdf Page 6-9

Tuesday, July 23, 2013

[worklog] 4-wire test failed analysis report

4-wire test failed analysis report
1. Background and failed phenomena:
   Background: this is a touch screen control board, support 4-wire and 5-wire touch screen. Verify the 4-wire and 5-wire touch function block diagram by simulating the 4-wire and 5-wire touch screen circuit.
   Phenomena: high fail rate on 4-wire test item, exclude the test issue. Test log/UI shows it is out of range.

2. Fail Rate
  Report 9% fail rate from QA team, 180 pcs/2000.

3. Test log file, compare the failed board with good board
  Good Board Test Log
***** 5 WIRE TEST *****
3.232, 0.058, 3.237, 0.060, 3.231, 0.056
IS  3818, 613   SB  3811, 600  ( 7, 13) -26036,  6864
3.231, 0.058, 3.237, 0.060, 3.231, 0.056
IS  1047, 3289   SB  1040, 3275  ( 7, 14)  11322, -31509
3.231, 0.058, 3.237, 0.060, 3.231, 0.056
IS  1078, 3127   SB  1077, 3122  ( 1, 5)  11698,  32469
3.232, 0.058, 3.237, 0.060, 3.231, 0.056
IS  3281, 1221   SB  3265, 1215  ( 16, 6) -31588,  13110
3.231, 0.058, 3.237, 0.060, 3.231, 0.056
IS  3443, 2913   SB  3444, 2910  (-1, 3) -29763,  30321
3.231, 0.057, 3.237, 0.060, 3.231, 0.056
IS  607, 3822   SB  600, 3811  ( 7, 11)  6847, -26068
3.232, 0.058, 3.237, 0.060, 3.231, 0.056
IS  586, 4028   SB  585, 4020  ( 1, 8)  6692, -23948
3.232, 0.057, 3.237, 0.060, 3.231, 0.056
IS  1967, 1064   SB  1952, 1060  ( 15, 4)  20599,  11537
***** 4 WIRE TEST *****
3.232, 0.057, 3.269, 0.018, 3.231, 0.058
IS  1019, 342   SB  400, 400  ( 619,-58)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  397, 397   SB  400, 400  (-3,-3)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  397, 1196   SB  400, 1200  (-3,-4)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  397, 1999   SB  400, 2000  (-3,-1)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  398, 2806   SB  400, 2800  (-2, 6)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  398, 3617   SB  400, 3600  (-2, 17)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  1196, 397   SB  1200, 400  (-4,-3)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  1196, 1196   SB  1200, 1200  (-4,-4)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  1197, 1999   SB  1200, 2000  (-3,-1)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  1196, 2806   SB  1200, 2800  (-4, 6)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  1196, 3617   SB  1200, 3600  (-4, 17)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2002, 398   SB  2000, 400  ( 2,-2)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2004, 1196   SB  2000, 1200  ( 4,-4)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2004, 2000   SB  2000, 2000  ( 4, 0)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2002, 2806   SB  2000, 2800  ( 2, 6)
3.232, 0.057, 3.238, 0.054, 3.233, 0.055
IS  2003, 3617   SB  2000, 3600  ( 3, 17)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2810, 397   SB  2800, 400  ( 10,-3)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2811, 1196   SB  2800, 1200  ( 11,-4)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2810, 1999   SB  2800, 2000  ( 10,-1)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2812, 2806   SB  2800, 2800  ( 12, 6)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  2812, 3617   SB  2800, 3600  ( 12, 17)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  3616, 397   SB  3600, 400  ( 16,-3)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  3617, 1196   SB  3600, 1200  ( 17,-4)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  3617, 1999   SB  3600, 2000  ( 17,-1)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  3617, 2806   SB  3600, 2800  ( 17, 6)
3.232, 0.057, 3.239, 0.054, 3.233, 0.055
IS  3616, 3617   SB  3600, 3600  ( 16, 17)

Failed Board Test Log
***** 5 WIRE TEST *****
3.258, 0.081, 3.261, 0.089, 3.257, 0.068
IS  3817, 602   SB  3811, 600  ( 6, 2) -25705,  7209
3.258, 0.081, 3.260, 0.089, 3.257, 0.068
IS  1041, 3277   SB  1040, 3275  ( 1, 2)  11582, -31164
3.257, 0.081, 3.261, 0.089, 3.257, 0.069
IS  1090, 3128   SB  1077, 3122  ( 13, 6)  11958, -32719
3.259, 0.081, 3.261, 0.089, 3.257, 0.068
IS  3278, 1208   SB  3265, 1215  ( 13,-7) -31279,  13453
3.258, 0.081, 3.261, 0.089, 3.257, 0.068
IS  3447, 2907   SB  3444, 2910  ( 3,-3) -29448,  30667
3.258, 0.081, 3.261, 0.089, 3.257, 0.068
IS  605, 3812   SB  600, 3811  ( 5, 1)  7097, -25721
3.258, 0.081, 3.261, 0.089, 3.257, 0.068
IS  595, 4020   SB  585, 4020  ( 10, 0)  6943, -23602
3.259, 0.081, 3.261, 0.089, 3.257, 0.068
IS  1956, 1057   SB  1952, 1060  ( 4,-3)  20879,  11881
***** 4 WIRE TEST *****
3.259, 0.081, 3.263, 0.089, 3.259, 0.068
IS  429, 370   SB  400, 400  ( 29,-30)
3.259, 0.081, 3.263, 0.089, 3.259, 0.068
IS  430, 371   SB  400, 400  ( 30,-29)
Due to the closed-source software, can’t understand the detailed log information clearly. But it is really fail on “out of range”.

4. Repeat the 1st level analysis action and verify
 

5..TBD...

6.


Thursday, June 27, 2013

[worklog] LED check, color sensor introduction

1.       TCS3414

   TCS3414 digital color light sensors are designed to accurately derive the color chromaticity and illuminance (intensity) of ambient light and provide a digital output with 16-bits of resolution. The devices include an 8 × 2 array of filtered photodiodes, analog-to-digital converters, and control functions on a single monolithic CMOS integrated circuit. Of the 16 photodiodes, 4 have red filters, 4 have green filters, 4 have blue filters, and 4 have no filter (clear). With the advanced patent pending in-package trim capability, device-to-device and system-to-system tolerance can be minimized allowing very precise repeatability to be attained.

2.       TSL252R

TSL252R are light-to-voltage optical sensors, each combining a photodiode and a transimpedance amplifier (feedback resistor = 16 MΩ, 8 MΩ, and 2.8 MΩ respectively) on a single monolithic IC. Output voltage is directly proportional to the light intensity (irradiance) on the photodiode. These devices have improved amplifier offset-voltage stability and low power consumption and are supplied in a 3-lead clear plastic sidelooker package with an integral lens. When supplied in the lead (Pb) free package, the device is RoHS compliant.

3.       TSL237T

The TSL237T light-to-frequency converter combines a silicon photodiode and a current-to-frequency converter on a single monolithic CMOS integrated circuit. Output is a square wave (50% duty cycle) with frequency directly proportional to light intensity (irradiance) on the photodiode. The digital output allows direct interface to a microcontroller or other logic circuitry. Output enable (OE) places the output in a high-impedance state for multiple-unit sharing of a microcontroller input line. The device has been temperature compensated for the ultraviolet-to-visible light range of 320 nm to 700 nm and responds over the light range of 320 nm to 1050 nm. The TSL237T is characterized for operation over the temperature range of -40°C to 85°C and is supplied in a compact 4-lead surface-mount package.

4.       BH1621FVC

BH1621FVC is an analog current output ambient light sensor. This IC is the most suitable to obtain the ambient light data for adjusting LCD and Keypad backlight of mobile phone for power saving. It is always used to check LED.

5.       OPT101

    The OPT101 is a monolithic photodiode with on-chip Tran impedance amplifier. Output voltage increases linearly with light intensity. The amplifier is designed for single or dual power-supply operation, making it ideal for battery operated equipment. The integrated combination of photodiode and Tran impedance amplifier on a single chip eliminates the problems commonly encountered in discrete designs such as leakage current errors, noise pick-up, and gain peaking due to stray capacitance. The 0.09 x 0.09 inch photodiode is operated in the photoconductive mode for excellent linearity and low dark current. The OPT101 operates from +2.7V to +36V supplies and quiescent current is only 120μA. It is available in clear plastic 8-pin DIP, and J-formed DIP for surface mounting. Temperature range is 0°C to +70°C.

Sunday, June 16, 2013

[work log] U1 (C8051F501) reprogramming failure analysis report (upload figure)

U1(C8051F501) reprogramming failure analysis report
1. Failed phenomena:
  U1 has F/W inside. Function of board is OK. The device (U1) can not been reprogram F/W, the programmer can't detect this device.

2. Fail Rate
  More than 1.5%, total ~80 pcs, verify ~40 pcs by ourself.

3. 1st level analysis by repair team
  Action1: use 1 pcs new IC to replace the failed one on the board, then pass;
  Action2: heat up this IC, can resume programming function, but still failed when cold down.

4. Repeat the 1st level analysis action and verify
  Take 2 pcs failed sample for example, S/N: L12A008354 and L12A008367, result is as below:
  4.1 Heat U1 (NG: L12A008354), can connect to programmer and reprogram F/W, but after the temperature of U1 is down,still failed (can't connect to programmer and reprogram F/W).
  4.2 Heat U2(NG:L12A008367), still failed. Retry to heat 1 time, failed again.
  4.3 Change 1 pcs new IC on NG board, then pass

5. 2nd level analysis based on board/circuit diagram, check the basic working condition
  The U1 is a microcontroller, so the basic working condition is power supply and oscillator. After measure the frequency and voltage by Osc, the basic condition can meet U1 requirement.

6. 3rd level analysis, signal check
  6.1 Measure and compare the signal of P1 that uses to connect to programmer.
 

Good Board
NG Board
PIN#
Connected
Disconnected
Connected
Disconnected
#1
3.3
3.3
3.3
3.3
#2
0
0
0
0
#3
0
0
0
0
#4
5
5
5
5
#5
2.5
2.5
2.5
2.5
#6
2.5
2.5
2.5
2.5
#7
5
5
0~0.999
5
#8
0
0
0
0
#9
0
0
0
0
#10
5
-3.3
5
-3.3

Measure the voltage between GND by DMM

PIN7 of P1 connector connect to PIN12 of U1 directly. Pin12 is the reset signal and low voltage is active. But when NG board connect to programmer, this signal keep "0" all the time, but disconnect to programmer, the signal is OK.
Refer to datasheet of C8051F501 
    6.2 Check the interface (C2) and the key signal from U1 (C8051F501)
  C2 Interface: C8051F50x-F51x devices include an on-chip Silicon Labs 2-Wire (C2) debug interface to allow Flash programming and in-system debugging with the production part installed in the end application. The C2 interface uses a clock signal (C2CK) and a bi-directional C2 data signal (C2D) to transfer information between the device and a host system. See the C2 Interface Specification for details on the C2 protocol. (Refer to section 28 of datasheet)
The result is as below:
Item
Sample #
U1 Signal Pin
Picture name#
Status
1
OK(L12A008367)
PIN12
ALL0000/ALL0001
Connected
2
OK(L12A008367)
PIN11
ALL0002/ALL0003
Connected
3
OK(L12A008367)
PIN11
ALL0004
Disconnected
4
NG(L12A008354)
PIN12
ALL0005
Connected
5
NG(L12A008354)
PIN11
ALL0006/ALL0007/ALL0008/ALL0009
Connected
6
NG(E13A021033)
PIN12
ALL0010/ALL0011
Connected
7
NG(E13A021033)
PIN11
ALL0012
Connected
  (Pin12 Good board) Vs. (Pin12 NG board)    
 
 (Pin11 Good board) Vs. (Pin11 NG board)

7. Conclusion and next action
  7.1 Conclusion is that raw material is bad.
  7.2 Send the failed chip samples to supplier for further failure analysis on chip level.

[work log]U1 (C8051F501) reprogramming failure analysis report

U1(C8051F501) reprogramming failure analysis report
1. Failed phenomena:
  U1 has F/W inside. Function of board is OK. The device (U1) can not been reprogram F/W, the programmer can't detect this device.

2. Fail Rate
  More than 1.5%, total ~80 pcs, verify ~40 pcs by ourself.

3. 1st level analysis by repair team
  Action1: use 1 pcs new IC to replace the failed one on the board, then pass;
  Action2: heat up this IC, can resume programming function, but still failed when cold down.

4. Repeat the 1st level analysis action and verify
  Take 2 pcs failed sample for example, S/N: L12A008354 and L12A008367, result is as below:
  4.1 Heat U1 (NG: L12A008354), can connect to programmer and reprogram F/W, but after the temperature of U1 is down,still failed (can't connect to programmer and reprogram F/W).
  4.2 Heat U2(NG:L12A008367), still failed. Retry to heat 1 time, failed again.
  4.3 Change 1 pcs new IC on NG board, then pass

5. 2nd level analysis based on board/circuit diagram, check the basic working condition
  The U1 is a microcontroller, so the basic working condition is power supply and oscillator. After measure the frequency and voltage by Osc, the basic condition can meet U1 requirement.

6. 3rd level analysis, signal check
  6.1 Measure and compare the signal of P1 that uses to connect to programmer.
 

Good Board
NG Board
PIN#
Connected
Disconnected
Connected
Disconnected
#1
3.3
3.3
3.3
3.3
#2
0
0
0
0
#3
0
0
0
0
#4
5
5
5
5
#5
2.5
2.5
2.5
2.5
#6
2.5
2.5
2.5
2.5
#7
5
5
0~0.999
5
#8
0
0
0
0
#9
0
0
0
0
#10
5
-3.3
5
-3.3

Measure the voltage between GND by DMM

PIN7 of P1 connector connect to PIN12 of U1 directly. Pin12 is the reset signal and low voltage is active. But when NG board connect to programmer, this signal keep "0" all the time, but disconnect to programmer, the signal is OK.
Refer to datasheet of C8051F501

















  6.2 Check the interface (C2) and the key signal from U1
  C2 Interface: C8051F50x-F51x devices include an on-chip Silicon Labs 2-Wire (C2) debug interface to allow Flash programming and in-system debugging with the production part installed in the end application. The C2 interface uses a clock signal (C2CK) and a bi-directional C2 data signal (C2D) to transfer information between the device and a host system. See the C2 Interface Specification for details on the C2 protocol. (Refer to section 28 of datasheet)



The result is as below:
Item
Sample #
U1 Signal Pin
Picture #
Status
1
OK(L12A008367)
PIN12(Reset/clk)
ALL0000/ALL0001
Connected
2
OK(L12A008367)
PIN11(Data)
ALL0002/ALL0003
Connected
3
OK(L12A008367)
PIN11
ALL0004
Disconnected
4
NG(L12A008354)
PIN12
ALL0005
Connected
5
NG(L12A008354)
PIN11
ALL0006/ALL0007/ALL0008/ALL0009
Connected
6
NG(E13A021033)
PIN12
ALL0010/ALL0011
Connected
7
NG(E13A021033)
PIN11
ALL0012
Connected

 











      (Pin12 Good board) Vs. (Pin12 NG board)














(Pin11 Good board) Vs. (Pin11 NG board)

7. Conclusion and next action
  7.1 Conclusion is that raw material is bad.
  7.2 Send the failed chip samples to supplier for further failure analysis on chip level.