Git Product home page Git Product logo

Comments (3)

gandrewstone avatar gandrewstone commented on August 15, 2024

In lin.h change this:
#define LIN_SERIAL HardwareSerial
to:
#define LIN_SERIAL SoftwareSerial

Now my software will use the SoftwareSerial object. This is only going to work if SoftwareSerial has the same member functions as HardwareSerial (I think it does but I forget).

Now in your program, construct your SoftwareSerial object, and pass it into my LIN code:

setup()
{
SoftwareSerial mySerial(2,16);
Lin myLin(mySerial, 16);
...
}

(and BTW your error is c++ conceptual, not specific to this LIN library -- study default parameters a bit more)

from lin.

tjb8907 avatar tjb8907 commented on August 15, 2024

Awesome. Got it to work. Thanks! Had to make a couple minor changes.

I put code you wrote about outside the setup function on my sketch, and I also had to change this:

Lin(LIN_SERIAL& ser=Serial ,uint8_t txPin=16);
to this:

Lin(LIN_SERIAL& ser,uint8_t txPin=16);

I had some luck with it. I get frame errors a lot which I am guessing is a conflict with the actual module sending a frame with the same ID I am sending. But it did work some. the response would be delayed sometimes. Guessing maybe every once in a my frame hits it just right and responds to the master before the other??

Also noticed that when I captured data with my logic analyzer, the interbyte spaces are much larger on the frames I am sending vs the frames on the LIN. Is that just a limitation of my hardware? It can only transmit so fast. I did make sure the baud was right. Both are at 19200.

from lin.

tjb8907 avatar tjb8907 commented on August 15, 2024

So changed set up a hardware serial again, and that seems to make the spaces smaller. however I did notice that the bits aren't quite the same duration. the 0 bits are about 62 microseconds and the 1 bits are about 42 microseconds. Wondering if that makes a difference.

Anyway, I am going to play around with it a little more tomorrow and see if I can get it to respond faster. I want to avoid intercepting the existing module that produces the same frame ID because I need that to function at all times. I could probably get away with a transistor that switched off and interrupts the LIN going to that module for just a split second while I send the frame I want.

Logic Analyzer pic.

image

from lin.

Related Issues (10)

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.