-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Software Serial #4
Comments
In lin.h change this: 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() (and BTW your error is c++ conceptual, not specific to this LIN library -- study default parameters a bit more) |
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:
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. |
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. |
I am trying to convert you code to use software serial, so I can use it the the analyzer board I built based on Zapta's project (https://github.com/zapta/linbus/tree/master/analyzer)
It uses a ATA6631 Lin Transceiver with the RX pin hooked do D2 and TX hooked to C2 (Analog 2, but used at digital)
Goal is to be able send a full frame at a given time. I have already reverse engineered the frame that I need.
Could you maybe give me some pointers?
Lin(LIN_SERIAL& ser=Serial,uint8_t txPin=1);
I know I would change the TX pin to 16 (A2).
I tried defining a software serial by including the Library, and then
'Software Serial mySerial(2,16);'
and then changing ser=Serial to ser=mySerial, but it said mySerial was not not declared in this scope.
The text was updated successfully, but these errors were encountered: