Giter Site home page Giter Site logo

lwiolink's Introduction

lwIOLink

License: GPL v3 version

"Buy Me A Coffee"

A Light weight IO-Link device communication library for Arduino.

This library reduces the complexity of the IO-Link communication to send (PDIn) and receive data (PDOut) over an IO-Link Master. The reason the library is called "light weight" is because it simplifies the communication and some of the "complex" features are missing. It must be noted that the aim of this library was not to follow the spec. but to simplify the communication by "dumbing down" the protocol. Hence this library can be used to understand how IO-Link works in a basic way, for commercial development please look for commercial alternatives as this library will not scale and is not optimized for production environments.

Features

  • Send PDIn
  • Recieve PDOut
  • Configurable Cycletime
  • Recover device after disconnection
  • Events

Caveats

  • The scope of this library is to build light-weight IO-Link devices.
  • It is not intended to use for production as it will probably not conform to the spec.
  • The library is not optimized for real-time applications as it polls for serial IO-Link data.
  • The library is not intended to be use to read IO-Link devices. You will need to develop your own IO-Link Master stack (which is out of the scope of this project).
  • There is no IODD available. The library is used to test the communication protocol. Please consult the IO-Link IODD spec to generate your own IODD.
  • The IO-Link Master inspection level has to be set disabled (NO_CHECK) as ISDU is not supported. See spec v1.1.3 for technical info about Inspection Level (Table 80 and Table E.3). Disabling it is IO-Link Master specific.

TODO

Low Priority

  • ISDU: ISDU processing requires to follow the IO-Link spec. and its state machines...left to any highly motivated developer out there to contribute ;)
  • Data Storage: Depends on ISDU, and it requires a HAL to access non-volatile storage.

Tested Arduino Targets

  • UNO (COM1,COM2)
  • ESP32 (COM1,COM2,COM3)
  • RPI Pico (COM1,COM2)

If you find that the library works for another Arduino board or does not work, notify me by opening an Issue.

Note: Some MCUs might not work in COM3 due to the timing constraings of the IO-Link spec. and the non-optimized Arduino Core libraries.

How to Use

You can test the library by using the demo located in the examples dir. In general the user has to define the process data size, and the cycle time. Whenever the device is in operate mode data from the master can be retrieved (PDOut) by implementing the callback function lwIOLink::OnNewCycle().

Its important that in the arduino loop() no blocking functions or functions that take a long time to execute (e.g. communication over I2C, reading ADC,etc) are not executed. This is because this library works in a polling fashion and is always looking for serial data to communicate with the IO-Link Master. The reason for this is that the Arduino Core API does not have a way to access Serial data over interrupts, in addition the API is not really standardized over all the cores so I tried to make it as simple as possible for portability reasons (within the Arduino ecosystem). Instead execute all your logic that could block this library in lwIOLink::OnNewCycle().

The cycle time should be set to the minimum required to get data for your arduino (for example reading an ADC, setting an RGB led stripe,etc). This is due to the fact that IO-Link can lose communication if the device does not reply quick enough. It is important to mention that lwIOLink::Device::SetPDIn() can be updated ( at any time, but will only be set if the device is in operate mode. For a more details about the api check the header of the library.

Hardware

  • Hardware-wise IO-Link requires an IO-Link device transceiver. Tested with an LT3669 transciever but theoretically any transciever, that has a UART interface (TX,RX), a Wakeup pin (for notification via interrupt) and an TXEN pin (pin that has to be pulled high to send data), should work.

Contributions

You are welcomed to make contributions by creating a pull request or sending your patch with information about the changes to [email protected] .

lwiolink's People

Contributors

unref-ptr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

lwiolink's Issues

IODD & PIN

Hello,
I would like to try your project but I have some issues.
First, could you add a iodd file with the project to try it more easily ?
Moreover on which pin do you plug your io-link's wire on the arduino uno (I think i plug it wright but just in case)?
thanks in advance

Problem: The device cannot be switched to Operate

I try to use max22513 as Phy of io-link

But when switching to the state of operate, it got stuck

I use the evaluation board of i-link protocol and MAXREF145 evaluation board to communicate with IO-Link slaves respectively.

After I checked, the device successfully entered the run mode, and successfully parsed to the first frame 0xA2 and CKT. After completing the following analysis, enter rsp
However, the command to switch the state has not been received, and the device is always in the run mode state without jumping out.

my question:

  1. What might be the reason why the device is not switched to operate?
  2. Does the protocol stack of the iolink master switch the device state in other ways?

My environment:
Arduino Mega 2560 + MAX22513 Evaluation Kit

Note 1: Due to the limited external interrupt pins of 2560, changed the Wake-up pin to Pin = 2
Note 2: The 2560 reads and writes the registers of the 22513 through the I2C protocol to enable

Excuse my broken English,
And to express my thanks for this IwLOlink library

IODD

Can You provide an IODD file example for the Demo

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.