Jump to content

bobql

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by bobql

  1. Hello,

    In the code snippet below I can output SPI at a frequency that I need.  However, I can only output 1 continuous command.  I would like to be able to burst more that 1 command at a time at a 1000Hz frequency.  For example, instead of sending rgdData only, i would like to send  (rgdData, rgdData2, rgdData3, rgdData4 ) and repeat.  Is there any way to do this in python?  I am trying to mimic the sensor feature in the waveforms GUI.  I can do it there but not in python.    I've also attached my full python code.

    ----------------------------------------------------------------

    # data sent out LSB first
    dwf.FDwfDigitalOutDataSet(hdwf, c_int(2), byref(rgdData), c_int(cBits))

    dwf.FDwfDigitalOutWaitSet(hdwf, c_double(spi_delay(hzFreq, 1e-5)))
    dwf.FDwfDigitalOutRepeatSet(hdwf,0)

    dwf.FDwfDigitalOutConfigure(hdwf, c_int(1))
    print("Generating output for 5 seconds...")
    time.sleep(5)

    dwf.FDwfDeviceCloseAll()

    DigitalOut_SPI v5 32bit works.py

  2. Hi @attila

    So, if I understand you correctly, I configure and run my pattern with DigitalOut_SPI.py and then use DigitalIn_Spi_Spy.py to capture the data.  Correct?

    I tried to run the my version of DigitalOut_SPI4.py (attached) but I can not see how to control the CS correctly.  Also, how do I insert hardware delays between frames? For example, if I wanted to burst SPI commands every 1ms.

    Right now I have it set to repeat 2x, but I need the CS to go high between each frame.  Can you tell me how to do that?  See scope shot of CS staying low for both 32 clock frames.

    Also, how do I get MSB first out instead of LSB first?

    Sorry for all the questions, but I am new to this...I tried searching the forum for similar questions and answers.  

    Thanks!

     

    badSpiTransaction009.png

    DigitalOut_SPI v4.py

  3. On 3/25/2024 at 8:08 AM, attila said:

    Hi @JAlaj

    If you are listening on signal use Protocol/SPI/Spy 'Receive to File' or for SPI master write a Custom script or Sensor for precise hardware timer.

    Hi Attila,

    Is there anyway to mimic in labview the "Sensor" feature implemented in the Waveforms GUI?  We have a 5 axis sensor that I would like to read at very consistent read rates.

    Below is a test case I have done using the a script in Sensor tab.  I found that the longer the iterations, the outcome is worse....i.e. timing is not correct.

    image.png.5dec187ac62c2f92a0aaf977eda935a6.png

  4. Hello, I am able to run a SPI example in python and I am trying convert the program into labview using functions from WaveForms™ SDK.  I am running into a problem with:

    rgbTX = (c_ubyte*4)(0x00,0x40,0x00,0x01)
    rgbRX = (c_ubyte*4)(0x00,0x00,0x00,0x00)

    # cDQ 1 MOSI/MISO, 8bit words, MOSI words, MISO words
    dwf.FDwfDigitalSpiWriteRead(hdwf, c_int(1), c_int(8), rgbTX, c_int(len(rgbTX)), rgbRX, c_int(len(rgbRX))) 

    I am having a hard time defining rgbTX and rgbRX in labview.

    image.png.c82a7a976cbe93dd31b5d2ffd179755b.png

    I've tried this below but it doesnt work.

    image.png.5c8cf21804e5eb9975c39dbb3ce72ee3.png

  5. Hello,

    I'm new to using Digilent tools.  I have been evaluating the SPI feature using Waveforms (ver 3.22.16 64bit) and am able to read and write from my slave device using 32-bit protocol.  Our new device will feature a 48-bit protocol, but I cannot get the protocol to work.  Is the tool limited to 32bit max?  If so, is there anyway to increase to 48bit?

    Thanks,

    Bob

    [UPDATE]: Fixed the issue:

    Instead of sending all 32bits like 0x12345678, I have to split it up 8bits at a time.

    For Example:  instead of this command Write(48, 0x0620004D55aa );  I need to use Write(8, 0x06, 0x20, 0x00, 0x4D, 0x55, 0xaa );

×
×
  • Create New...