Skip to main content
FW version: Stable

Production scripting

info

TLDR: Individual tools can be run from the system command line, i.e. they can be used by any higher-level scripting language. In this way, they are ready for various kinds of automated usage.

Production scripting becomes useful once the project with an integrated siliXcon device yields into mass production. For such purpose, we offer our End-of-Line scripting guides. In this documentation, we will explore the utilization of tools such as yosctl and term for performing elementary operations on devices. The key advantage of these tools is their ability to be seamlessly integrated into various automated workflows using high-level scripting languages like Python or Bash.

Using tools like yosctl and term you can perform elementary operations on the device. Like:

  • set parameter yosctl var set /driver/iref 0.5
  • read parameter yosctl var get /driver/iref
  • run command yosctl cmd exec identrun
  • save parameters yosctl cmd exec save -y
  • get serial number yosctl id parse sn
  • get hwid yosctl id info hwid
  • run YOS script term script.ys

All the aforementioned operations can be seamlessly incorporated into high-level programming languages such as Python or Bash. This adaptability enables efficient control of your production line or automated testing processes, enhancing overall productivity and reducing manual intervention.

An example of production workflow in Python

Here is an example of a production workflow in Python. Check the link below for full code.

In the example, we use the swtools and yos_device libraries. The libraries are just wrappers around the SWTools binaries. This allows you to write simple Python code to automate your production.

Github - siliXcon EoL example

This is only part of the code. The full code can be found on the link above.

import swtools
import yos_device
import sys
from swtools import swtools_connection_options as conn

DEVICE_ADDRESS = 0
MSGCONF_STRING = "3:4" # CAN speed 500 kbps

swt = swtools.swtools(
conn=conn(
interface="usb",
addr=DEVICE_ADDRESS,
msgconf_str=MSGCONF_STRING,
)
)
device = yos_device.yos_device(swt)


def example():
print("SN: " + device.get_sn())
print("HWID: " + device.get_hwid())
print("SWID: " + device.get_swid())
print("CAN settings: " + device.get_msgconf(3))

print("Controller temperature: " + str(device.get_var("/driver/temp")))

print("Restore default config:")
device.restore()
print("Push config:")
swt.yosctl_push(file="config.yc")

print("Run YOS script:")
ret = swt.script_std("esc3-selftest.ys")
print()
print("Script return code: " + str(ret))


# Check if device is connected and do interface clain
if device.is_NOT_on(fast=True):
print("Device is not connected")
sys.exit(1)

# Login to device
device.login()
swt.conn.set_if("usb")

example()

print()
print("Changing interface to kvaser and do the same over again")
print("=======================================================")

swt.conn.set_if("kvaser")
# After you change the interface, it is neccesary to run "yosctl id claim".
# This is done inside the function "is_NOT_on"

if device.is_NOT_on(fast=True):
print("Unable to connect using kvaser")
sys.exit(1)

example()


print("Example finished")
sys.exit(0)