[FAQ] DRV8000-Q1: [FAQ] DRV Motor Drives GUI Scripting Feature

Part Number: DRV8000-Q1

Tool/software:

FAQ:  How to use the Scripting Window in an EVM GUI

Recent EVM GUI’s include a new feature called the Scripting Window.  You can access this by clicking Tools, Scripting Window from any page in the GUI after connecting your EVM. 

This will open the scripting window in a new tab.  This window reads and writes to the data in your GUI tab, so the GUI tab must remain open while you are using the scripting functions.  You can switch back and forth between tabs at any time.

The controls on the interface are as described below:

  1. File selection dropdown. This will default to an example file, but you can use this dropdown to select a different demo file or a file you upload yourself, or a recorded script file.
  2. Open Script. Click this to open file explorer and select your script file.  Files can be any text format such as .txt or .js. 
  3. Save Script. Save the active script to your computer.
  4. Remove Script. Deletes the active script from the scripting window. Clickable after you record a new script or upload one of your own, you cannot delete the example script. 
  5. Run. Executes the active script.
  6. Stop. Stops running the active script
  7. Start/Stop Recording. Creates a new script file, and logs the actions performed in the GUI window.  Clicking the button again while recording a script stops recording the script.
  8. Pause/Resume Recording. Pauses recording the script, and clicking it again will resume recording the script in the same file.
  9. Toggle Console View. Shows the Logs window.  Useful to show any errors when running the script.

The scripting window supports editing a script, but the example script included in the GUI is Read-Only.  The easiest way to make a file you can edit is to click the “Start Recording” button, then “Stop Recording,” and copy-paste the example script file into your file. 

One current limitation of the Recording feature is that it can only record and log register map changes such as a SPI write command.  It cannot record interactions with GUI buttons such as changing the PWM duty cycle or turning nSLEEP on/off.  Refer to the example script for your GUI for reference on how to interact with these GUI controls via scripting. 

A limitation of the scripting window/feature in general is performing exact timing.  A “1 second” delay in the script will not be exactly 1 second, it might be 0.8 seconds or it might be closer to 2 seconds.  This is because the EVM communicates to the PC asynchronously approximately once per second.  The microcontroller on the EVM runs updates every ~20ms for smooth acceleration profiles and fast response of onboard LEDs.  However, the GUI will only update every ~1 second, so the scripting features can also only modify device settings every ~1 second.  Therefore, the scripting feature might not work if you need precise timing.