my ideas in action

Monthly Archives: November 2012

CMOS Levelshifter with memory problems

I want to comment a little bit about a classical CMOS level-shifter that has a less known issue.

The level-shifter is used to transfer logic signals from a low voltage domain ( example 1V8) to a higher voltage ( ex 3V3). This level-shifter works fine in almost all applications, when 1V8 and 3V3 supply voltages are present.

But what is happening when one of the supply is missing ?

Case A : 3V3V is zero. In this case the output is forced to zero since there is no supply for inverter T7,T8.

Case B: 1V8 is missing. This is more complicated. Because the T1, T2 form a latch, they will keep the state for long time. The value is not hard defined so it may change after some time.

But the issue that I want to present is that if for example the latch had a certain state when the 1V8 was present then it will keep that state even if the 1V8 will disappear. It is the very nature of the latch to keep his data as long as possible.

So lets say that the 1V8 has present and IN=high. It means that INB=low and A=high (3V3) and B=low (zero). The OUT is low.

If the 1V8 disappear very fast , so that the IN do not have time to toggle then what is happens ? The INB stay low since there is no supply on 1V8 rail. The IN = low since there is nobody to drive this input. The circuits that are connected  to IN were supplied also by 1V8 rail. The T3 and T4 have now both the gates to VSS. So the latch T1,T2 has no reason to change his state. The 3V3 is still present so the latch keep his state. So is easy to see that the latch still give OUT=low even if there is nobody to drive the input of the level-shifter.

What is happening when the 1V8 come back ? The inverter T5,T6 keep his state until the V1V8 is high enough (>Vth) and only after that toggle to the signal on IN.

This memory effect can be a feature of a issue.

It may be considered a feature if by memorizing the state it is doing something useful in the system.

If not , then it can be considered a issue/problem/bug since sometime we want to know that 1V8 do not exist anymore and we may need some signals to be reseted.

So use this level-shifter it with great care. And if you do not need this “memory” effect, then do not use this latch type level-shifter.


Take all columns that have a specific header

Lets say that you have this kind of csv files, named like:


and each file contain columns with data. Each column has a unique header like this :

> cat results_30C_deviceA.csv
Vport1 Vport2 Vport3
11 123 4545
22 123 4545
33 123 4545
44 123 4545

And you want to extract all columns that contain string “Vport2” from all files but to keep the order of temperatures in the normal order ( like -45C, 0C, 30C, 125C…)

The Solution is to sort them in order and then to use PR and AWK. The PR will concatenate all files in a big file with all columns. AWK will print only the columns that have the string on the first row.

 pr -m -t -s `ls | sort -n -t _ -k 2` | awk 'NR==1{for(i=1;i<=NF;i++)if($i~/Vport2/)f[n++]=i}{for(i=0;i<n;i++)printf"%s%s",i?" ":"",$f[i];print" "}'

It is only one line, but is hard to understand it .

Please notice the following:

ls = list the files from current folder

sort -n option = treat strings as numbers

sort -t _ option = consider the names as strings separated by “_” delimiter

sort -k 2 option = order the files based on 2nd field , considered as number ( -n option) , so first fill be -45C, then 0C, then 30C, then 125C, then 150C. If you do not use this option then  the order will be 0, 125, 150, 30, -45

ls and sort commands are inside a “ . This is the symbol that is on the same key with ~  (top left corner )!!!!. This is not the ‘ apostrophe  !

for AWK option please read the manual or search the web.

The result will be

Vport2 Vport2 Vport2 ....
123 123 123
123 123 123
123 123 123

The new file will contain no info about the name order but you know that is in good order because of “sort” command.

Other solution may be possible but this worked for me.

The AWK was inspired by this post :