print("  MOSI: {:c}{}".format(ord('A')+port, bit))
    (port, bit) = fl.progGetPort(conn, fl.LP_SS)
    print("  SS:   {:c}{}".format(ord('A')+port, bit))
    (port, bit) = fl.progGetPort(conn, fl.LP_SCK)
    print("  SCK:  {:c}{}".format(ord('A')+port, bit))
    print("}")

    fl.jtagClockFSM(conn, 0x0000005F, 9)
    fl.jtagShiftInOnly(conn, 32, BYTE_ARRAY)
    bs = fl.jtagShiftInOut(conn, 128, fl.SHIFT_ONES)
    print("jtagShiftInOut() got {} bytes: {{\n  {}\n}}".format(
        len(bs),
        " ".join(["{:02X}".format(b) for b in bs])))

    fl.jtagClockFSM(conn, 0x0000005F, 9)
    fl.spiSend(conn, BYTE_ARRAY, fl.SPI_LSBFIRST)
    bs = fl.spiRecv(conn, 8, fl.SPI_LSBFIRST)
    print("spiRecv() got {} bytes: {{\n  {}\n}}".format(
        len(bs),
        " ".join(["{:02X}".format(b) for b in bs])))
    fl.progClose(conn)

    print("jtagScanChain(): {")
    for idCode in fl.jtagScanChain(conn, PROG_CONFIG):
        print("  0x{:08X}".format(idCode))
    print("}")

    print("flProgram()...")
    fl.flProgram(conn, "J:{}:../../../../hdlmake/apps/makestuff/swled/cksum/vhdl/fpga.xsvf".format(PROG_CONFIG))
    print("...done.")
示例#2
0
PROG_CONFIG = "B3B2B0B1"
handle = fl.FLHandle()
try:
    fl.flInitialise(0)

    # Connect, reset the board, open SPI interface & get SS port:
    handle = fl.flOpen(VID_PID)
    fl.flMultiBitPortAccess(handle, "B6-,C2-")  # RESET low & cut the power
    fl.flSleep(10)
    fl.flSingleBitPortAccess(handle, 2, 2, fl.PIN_HIGH)  # power on in RESET
    fl.progOpen(handle, PROG_CONFIG)
    (port, bit) = fl.progGetPort(handle, fl.LP_SS)
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_HIGH)
    
    # Send JEDEC device-id command, retrieve three bytes back
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_LOW)
    fl.spiSend(handle, b"\x9F", fl.SPI_MSBFIRST)
    bs = fl.spiRecv(handle, 3, fl.SPI_MSBFIRST)
    print("JEDEC ID: {}".format(
        " ".join(["{:02X}".format(b) for b in bs])))
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_HIGH)
    
    # Close SPI interface, release reset and close connection
    fl.progClose(handle)
    fl.flMultiBitPortAccess(handle, "B6?")  # release RESET

except fl.FLException as ex:
    print(ex)
finally:
    fl.flClose(handle)
示例#3
0
VID_PID = "1D50:602B:0001"
PROG_CONFIG = "B3B2B0B1"
handle = fl.FLHandle()
try:
    fl.flInitialise(0)

    # Connect, reset the board, open SPI interface & get SS port:
    handle = fl.flOpen(VID_PID)
    fl.flMultiBitPortAccess(handle, "B6-,C2-")  # RESET low & cut the power
    fl.flSleep(10)
    fl.flSingleBitPortAccess(handle, 2, 2, fl.PIN_HIGH)  # power on in RESET
    fl.progOpen(handle, PROG_CONFIG)
    (port, bit) = fl.progGetPort(handle, fl.LP_SS)
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_HIGH)

    # Send JEDEC device-id command, retrieve three bytes back
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_LOW)
    fl.spiSend(handle, b"\x9F", fl.SPI_MSBFIRST)
    bs = fl.spiRecv(handle, 3, fl.SPI_MSBFIRST)
    print("JEDEC ID: {}".format(" ".join(["{:02X}".format(b) for b in bs])))
    fl.flSingleBitPortAccess(handle, port, bit, fl.PIN_HIGH)

    # Close SPI interface, release reset and close connection
    fl.progClose(handle)
    fl.flMultiBitPortAccess(handle, "B6?")  # release RESET

except fl.FLException as ex:
    print(ex)
finally:
    fl.flClose(handle)