Oct 152018
 

If you are using RoboCopy to make backups, you might have noticed it’s a bandwidth hog. Once you start copying, it will saturate the network making it a bit annoying to copy anything else at the same time.

While RoboCopy has no understanding of bandwidth limiting, there is a concept of inter-packet gap pause. Yes, you can go and calculate it (with a varying degree of success) or you can just test a few runs with different IPG number.

I personally found that /IPG:7 works wonderfully for my background backups.

Oct 102018
 

When it comes to CAN bus protocol decoding, beating PicoScope is hard considering that even the cheapest 2000 series member has full support for it. Converting such scope to one with the floating ground is as easy as unplugging your laptop (or running your desktop of an UPS’ battery). However, there are a few issues you might want to avoid.

The very first step would be to properly trigger on the CAN bus message. Reasons for this are twofold. If there is any issue with your signal, this will allow you to catch it early so you can sort out basic electrical stuff before going on the higher level. Secondly, reliable triggering will help software decoder properly detect message start.

While exact trigger level might depend on the exact use case, in 95% of cases we are talking of 5V differential signal. Roughly speaking, your CAN L (low) signal will be either at 2.5 V or 0 V logical level and your CAN H (high) signal will be at either 2.5 V or 5 V level. Since signal between those two lines is mirrored, you only need to probe one of those two lines. I usually select L but that’s just because I already have cable made for it. All instructions are essentially the same whichever polarity you select. Good starting trigger level for low line is 2 V (3 V for high line). If your resting signal is further away from 2.5 V that would either point to termination issue or gross impedance mismatch and you should sort “electricals” first before continuing further.

Example CAN bus probeI like to set pre-trigger level to 5% as it allows me to use most of the screen for actual signal. To receive the maximum screen real estate you might be tempted to use 0% pre-triggering but I find seeing a bit of signal before my CAN message does help if you have a busy bus. Even better, this also allows you to ignore trigger edge setting completely (should be falling for low line).

Only once you can reliably catch your CAN signals, you can add serial decoder – Tools / Serial Decoding / Create / CAN. After selecting channel with your signal (named Data on this form), you will reap the benefits of getting triggers right. First and foremost, you should have bitrate set correctly as soon as channel is selected. More over, your threshold level should be automatically calculated from the signal. Yes, you can manually set it to 2 V but Murphy says you’ll forget it and then be confused as why decoding has errors or even misses a message completely. Lastly, you select High or Low setting appropriately depending on the line you are probing.

Congratulations! If all went good, you have just successfully decoded CAN bus message.

Oct 042018
 

You should never depend on root login when dealing with OpenStack cloud. Pretty much all pre-prepared cloud images have it disabled by default. Ideally all your user provisioning should be done as part of the cloud-init procedure and there you should either create your own user or work with the default cloud-user and the key you provisioned. But what if you are troubleshooting some weird (network) issue and you need console login for your image?

Well, you can always re-enable root user by directly modifying qcow2 image.

To edit qcow2 images, we need first to install libguestfs-tools. On my Linux Mint, that requires the following:

# sudo apt-get install libguestfs-tools

Of course, if you are using yum or some other package manager, adjust accordingly. :)

Once installation is done, we simply mount image into /mnt/guestimage and modify the shadow file to assign password (changeme in this example) to the root user:

# sudo mkdir /mnt/guestimage
# sudo guestmount -a rhel-server-7.5-update-3-x86_64-kvm.qcow2 -m /dev/sda1 /mnt/guestimage
# sudo sed -i 's/root:!!/root:$1$QiSwNHrs$uID6S6qOifSNZKzfXsmQG1/' /mnt/guestimage/etc/shadow
# sudo guestunmount /mnt/guestimage
# sudo rmdir /mnt/guestimage

All nodes installed from this image will now allow you to use root login with password authentication. Just don’t forget to remove this change once you’re done troubleshooting.

PS: While I use Red Hat image in the example, the procedure also applies to CentOS and most of other cloud distributions too.

Sep 302018
 

If you are into electronics, probably the first test device you’ll own will be a multimeter. Not only you can get it for dirt cheap – my first multimeter was less than $10 in today’s money – but you can also do a lot in digital electronics with multimeter alone.

As I pawed my road to electronics with quite a few good and bad multimeters, I want to share my thoughts on what is important for a decent general purpose multimeter. I will stick to Agilent/Keysight U1232A and EEVBlog 121GW for most of my comparisons as these are two multimeters I use these days. However, principles are general and can be applied to any multimeter.

The very first thing I need of multimeter is to be safe. When I just started with electronics I didn’t care about that because I worked with low DC voltages only. However, sooner or later I would measure something on 240 V line. And not all multimeters would survive – some failing spectacularly. Having kids of curious age I like to have all my meters CAT rated and UL listed. And most of good meters will not die even if you do something utterly stupid like connecting to line voltage while in current range. Higher cost does offer higher survivability.

The next thing I find very important is speed. Having a high digit count is nice but it usually comes at the cost of speed. I find that 6000 count on my Agilent is much more comfortable for general measurement than 50000 counts EEVBlog has to offer. Yes, high digit count is important for certain scenarios and it’s not too bad to have one such meter available. But, if I had to choose one multimeter, I would go for a faster one. That said, don’t go under 6000 counts.

In regards to speed, a special attention should be shown toward continuity check. Regardless of the display update speed, continuity tester must be fast and latched. Even the most minute contact between probes has to result in the (low volume, please) beep or flash. While most people prefer beep, I find backlight flash really great but that might be due to most of my work taking place during night when flash is easily visible and laud noises are not really desired. Speaking of flash, I love option to turn backlight with a single button. If you ask me, I would set all my multimeters to have backlight by default – battery life be damned – but I will be OK if I can turn light on easily.

I prefer when each measurement is a separate selection on a range switch as it makes switching between them a breeze. Multimeters with a lot of options tend to have just a few ranges but with Mode button switching between them. 121GW is specially nasty in this area as, not only it requires mode button but it also remembers the last mode selected. While this sounds like a good idea, it ensures that I need to check every time by looking onto display (that requires long press for backlight) before doing any work. This alone is probably the major reason why my Agilent sees much more use despite 121GW having more functionality and better specs.

Speaking about more functionality, I found 121GW’s mV range a real gem. If your multimeter gives you decent resolution it can pretty much substitute measuring current altogether. Just measure voltage drop over a resistor (or fuse) and you have all that’s needed to calculate current. Much easier than switching to current range and inserting multimeter into the circuit. Yes, this won’t work if you need precise and/or low-current measurement, but it works well to get ballpark figure and that’s often all that’s needed anyhow.

And order of measurements on the range switch is equally important. I prefer my order to be Low-Z voltage measurement, Off, DC voltage, AC voltage, other voltage related measurements, current, and finally the second off position. While this does prevent me from easily turning off multimeter by just moving switch into the far left position, it enables me to setup all on board and go into voltage measurement directly without traveling through Low-Z mode. While I love low-Z mode, I do not like when I have to go over it from off position (Agilent did this beautifully). Speaking of low-Z, idiotic restrictions like 12V minimum voltage for it to work 121GW has make it more nuisance than an useful range.

If you are into temperature measurement, you will want support for standard K-type probes. Agilent here fails miserably as it requires special adapter to do it. My personal opinion is that, if any special adapter is required for measurement, that functionality might as well not exist.

Functionality I found awesome but it’s rarely implemented these days is a simple frequency counter. Yes, both U1232A and 121GW can measure frequency but range is laughably small (up to 100 kHz and 1 MHz respectively). When you deal with PWM circuits or you just want to check clock lines, a decent frequency measurement (like UT71C has – up to 40+ MHz) means you don’t need to pull out the scope most of the time.

Having the low burden voltage is an excellent thing in theory as it can mean a difference between being able to measure circuit’s current or not. In practice it depends on your use case. For me, working on 3.3V and 5V circuits, there is more than enough margin to handle any drop multimeter brings in.

Diode measurement should be a separate range so LED (or any other diode) polarity can be tested without much effort. If you are dealing with LEDs a lot, investing in multimeter that supports higher test voltage (like 15V on 121GW) does come in handy.

Other features worth mentioning include True RMS and auto-hold functionality. I found that not having either is not a breaking deal but they do come in useful once in a while.

I do require support for either AA or AAA batteries in any multimeter I use. Not only 9V has generally inferior capacity but it’s also something I don’t ever have when I need it. There is simply no justification this day and age why standard batteries shouldn’t be used. And battery compartment should have a captive screw unless you want to spend 15 minutes searching for it every time you change the batteries.

Every decent multimeter will have a way of connecting to the computer for logging purposes. While bluetooth seems like a good idea, I found it lacking in practice as I would often find something would go wrong with it overnight. A nice physical cable is my preferred solution here.

In regards to the probes I find silicone is a must as stiff probe cables will be a hindrance. Tips have to be sharp and ideally their CAT III/IV insulation should be removable. Fully insulated probe is fine when dealing with high voltages or narrow spaces but often more exposed metal makes for easier measurement.

Unfortunately, finding the multimeter with all these features is hard if not impossible. Every multimeter – regarless of the price range – will have something missing. However, with two multimeters you can come darn close.

 
PS: Notice I haven’t spoke about precision at all as needs are highly dependent on the exact use case. For me 1% on DC is OK and this is something easily found in any decent multimeters.

PPS: One enjoyable thing you cannot really know until you see it also how multimeter fits in its carry case. Agilent is perfect here as you have range switch, all buttons, and probe holes reachable without ever getting it out.