Giter Site home page Giter Site logo

l6470's Introduction

L6470

Python library for coontrolling STMicroelectronics L6470 using SPI.

Install

Clone l6470 repogitory local from github.

$ git clone https://github.com/DaiGuard/l6470

Install using setuptools.

$ cd l6470
$ sudo python3 setup.py install

Demo Hardware

This demonstration is performed using JetsonNano (Nvidia) and AE-L6470DRV (Akizukidenshi).
and the motor uses P-PMSA-B60D3 (Plexmotion).

The pin assignment is show in the table.

Jetson Nano AE-L6470DRV
Pin 19 (SPI_MOSI) --> CN4-7 (SDI)
Pin 21 (SPI_MISO) <-- CN4-5 (SDO)
Pin 23 (SPI1_SCK) --> CN4-6 (CK)
Pin 24 (SPI1_CS0) --> CN4-8 (#CS)
Pin 25 (GND) <-> CN4-3 (GND)

Usage

Sample code samples/sample_run.py

# coding: utf-8

# import l6470 module
from l6470 import l6470

import time

if __name__ == '__main__':

    device = None

    try:
        # open spi device bus:0, client0
        device = l6470.Device(0, 0)

        # reset L6470 
        device.resetDevice()

        # parameter value setting
        device.setParam(l6470.MAX_SPEED, [0x10, 0x00])
        device.setParam(l6470.STEP_MODE, [0x03])
        device.setParam(l6470.KVAL_HOLD, [0x39])
        device.setParam(l6470.KVAL_RUN,  [0x39])
        device.setParam(l6470.KVAL_ACC,  [0x39])
        device.setParam(l6470.KVAL_DEC,  [0x39])

        # exec "run" command
        device.run(True, [0x00, 0x10, 0x00])

        for i in range(5):

            time.sleep(1)

            # get device status
            status = device.updateStatus()
            print(status)

    except KeyboardInterrupt:
        pass
    finally:
        if device is not None:
            # exec "soft_stop" command
            device.softStop()

Run the sample with the following command

$ cd l6470/samples
$ python3 sample_run.py

Test

$ cd l6470
$ python3 setup.py test

l6470's People

Contributors

daiguard avatar matsujirushi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.