Sunday, May 13, 2012

Hardware testing with python -- itertools

As part of tracking down a mysterious power-supply sequencing issue, there was a need to try all permutations of the 4 power domain adjustment sequence.

When the hardware shows up on the PC as objects in an IPython session, the solution is easy: itertools.

from itertools import permutations
def ps0: v430.vdd = 1.2
def ps0: v430.dvdd = 2.5
for p in permutations([ps0, ps1, ps2, ps3]):
    print 'order:', p
    for s in p:
Then, turn to the oscilloscope, hit enter, and observe the behavior of the 24 permutations.  Correlate the observations with the supply-setting order to continue with your day of debugging.

Sometime, the FTDI FT4232H-based USB link to the hardware will be described and libraries posted.  Until then...

No comments: