Menu

UrJTAG with Python bindongs

Smartcat
2017-04-12
2018-11-21
  • Smartcat

    Smartcat - 2017-04-12

    I managed to build UrJTAG (with Python3 binding turned ON) to run on a Raspberry Pi2.

    After compiling, the executable launch by"sudo JTAG" launched and detected the device correctly

    The device has this in the BSDL (I am only pasting the 2 pins where I am working on)

    bit 185 I 1 PB00_10
    bit 184 O 1 PB00_10 183 0 Z
    bit 183 C 0 *
    
    bit 137 I 1 PB01_08
    bit 136 O 1 PB01_08 135 0 Z
    bit 135 C 0 *
    
    jtag> INSTRUCTION EXTEST
    jtag> SHIFT IR
    jtag> set signal PB00_10 out 1  // Confirmed Bit Set OK
    jtag> SHIFT DR
    jtag> set signal PB00_10 out 0  // Confirmed Bit Set OK
    jtag> SHIFT DR
    
    jtag> SHIFT DR
    jtag> get signal PB01_08    // Confirmed bit read OK 
    jtag> SHIFT DR
    jtag> get signal PB01_08    //Readback OK
    

    So all looks fine.
    I attempted to do the same sequence in Python3. I was able to get the ID code correct

    import urjtag
    
    urc = urjtag.chain()
    urc.cable("jlink")
    urc.reset()
    
    urc.tap_detect()
    
    length = urc.len()
    for i in range(0,urc.len()):
        idcode = urc.partid(0)
        print("[%d] 0x%08x" % (i, idcode))
    

    Up to here everything looks OK. No error message and the DeviceID was detected correctly.

    Next I tried to
    send a bit out to PB00_10 (index 184)
    read a bit back from PB01_08 (index 137)

    urc.set_instruction("EXTEST")
    urc.shift_ir()
    
    # try to set the corresponding pin to 1
    urc.set_dr_out(1, 184)    
    urc.shift_dr() 
    # try to set the register bit to 0
    urc.set_dr_out(0, 184)    
    urc.shift_dr() 
    
    # try to readback the pin state into the register
    urc.shift_dr()
    drval = urc.get_dr_in()  
    

    Neither of the instruction set or get instructions are doing what I need it to do.

    Appreciate if anyone could advise path to move forward.
    Thanks

     

    Last edit: Smartcat 2017-04-12
  • Steve Tell

    Steve Tell - 2017-07-05

    I think you've got in and out reversed: to set output pins or control bits, use set_dr_in() to set values that will get scanned in to the chain of chips on TDI.
    To fetch status captured from pins or internal state and then scanned out of the chip on TDO, use get_dr_out(). These are the directions used inside the urjtag code, and are necessarily backwards from the way you think of pins controlled or observed with the boundary scan register.

    get_dr_in() is useful mainly to see what other python code has set.
    set_dr_out() isn't very useful.

    the examples in doc/urjtag-python.txt could probably be improved.

     
  • Ilan

    Ilan - 2018-11-21

    Hi SMARTCART,
    I will be glad if you send the files project with instractions,
    can you explain in details how you create the project ?
    in hardware what you connects and how?
    in software which lib you install?
    can i test bus data etc,,,
    thank you

     

Log in to post a comment.