Git Product home page Git Product logo

lin-transceiver-library's Introduction

LIN-Transceiver-Library (TJA1020)

Using a LIN Bus via TJA1020 Transceiver needs to handle the statemachine bevor you will be able to send or receive data from the bus. This is encapsulated within this class.

dependencies

This library extends the Lin-Interface Library: https://github.com/mestrode/Lin-Interface-Library

example

Take a look into the basic example.

Library should work like the Lin-Interface Library, but considers the statemachine in every readFrame and writeFrame method. You can also control the statemachine, eg. the default slope mode.

    #include "TJA1020.hpp"

    #define LIN_SERIAL_SPEED 19200
    #define lin_NSLP_Pin 32

    // RX and TX Pin is defined per UART_nr
    TJA1020 LinBus(2, LIN_SERIAL_SPEED, lin_NSLP_Pin); // UART_nr, Baudrate, /SLP-Pin

    void setup()
    {
        // use LowSlope mode all the time
        LinBus.Slope(LinBus.LowSlope);
    }

    uint8_t getData()
    {
        uint8_t data = 0x00;

        // Read Frame ID = 0x20
        if (LinBus.readFrame(0x20))
        {
            // Read succesfull
            data = LinBus.LinMessage[0]; // only consider byte 0 of the received data
        }

        // let LIN-Tranceiver sleep --> changes also the INH Pin of the TJA1020
        LinBus.setMode(LinBus.Sleep);

        return data;
    }

see also

lin-transceiver-library's People

Contributors

mestrode avatar olivluca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lin-transceiver-library's Issues

Hardware connection details?

Hello,

I'm using this library (actually my fork just to adjust a couple of things) to try and control a truma combi d (i.e. to emulate a CP plus control panel).
I adapted this code https://gitlab.womolin.de/public-repository/esp32-tin-master and I'm using the connection described here https://github.com/danielfett/inetbox.py
Additionally, since this is a master, I connected the INH and LIN terminals of the breakout board (as per the datasheet, the board has already a resistor and a diode between the INH pin and the INH terminal) and an output of the esp32 to the SLP terminal.
Unfortunately I don't get any answer from the truma. I see the echo of what I send (only if I supply 12V to the board) but nothing else.
I'm wondering if the board is faulty, I connected it wrong or I didn't adapt the software correctly.
I also tried the origina repo (after adapting it from the original esp8266 to the esp32) with no success either (and since it doesn't control the state machine I think it's expected, however the inetbox.py repo doesn't control it either and there are people using it).
Any hint?

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.