sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 9, 2019 21:47:16 GMT
This code work perfect on Mega:
//******************************************************************************************************************** //LIN //******************************************************************************************************************** #include <lin.h> Lin lin(Serial1, 18); int LIN_Enable = 7;
but when is compiled on Shieldbuddy this error apear: exit status 1 no matching function for call to 'Lin::Lin(SerialClass2&, int)'
Somebody has this problem before?
|
|
|
Post by Admin on Jan 10, 2019 9:57:14 GMT
Are you using a standard shield with a LIN transceiver? If so, which on is it?
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 10, 2019 14:39:35 GMT
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 10, 2019 16:23:14 GMT
I update to last Shieldbuddy files, 1.63, now this error apears:
C:\Program Files (x86)\Arduino\libraries\LIN-master\lin.cpp:27:24: fatal error: util/delay.h: No such file or directory
#include <util/delay.h>
|
|
|
Post by Admin on Jan 10, 2019 16:39:22 GMT
The lin.cpp in the LIN libarary is using _delay_us() rather than delayMicroseconds() for some reason. We will fix this properly in the next release but in the meantime, edit the LIN.CPP as per:
#include "Arduino.h" #include "lin.h" //#include <util/delay.h> /* Not available in the ShieldBuddy */
/* Define the ShieldBuddy's delayMicroseconds to _delay_us */ #define _delay_us delayMicroseconds
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 10, 2019 18:31:27 GMT
Thanks it seems to solve the problem of timing.
now this works:
Lin lin;
but when i try to redirect to another like Serial1, 2 etc this get me this error:
exit status 1 no matching function for call to 'Lin::Lin(SerialClass3&, int)'
I think is related to the class Lin:
class Lin { protected: void serialBreak(void); // For Lin 1.X "start" should = 0, for Lin 2.X "start" should be the addr byte. static uint8_t dataChecksum(const uint8_t* message, char nBytes,uint16_t start=0); static uint8_t addrParity(uint8_t addr);
HeapSkew<LinScheduleEntry> scheduler;
public: Lin(LIN_SERIAL& ser=Serial,uint8_t txPin=1); LIN_SERIAL& serial; uint8_t txPin; // what pin # is used to transmit (needed to generate the BREAK signal) int serialSpd; // in bits/sec. Also called baud rate uint8_t serialOn; // whether the serial port is "begin"ed or "end"ed. Optimization so we don't begin twice. unsigned long int timeout; // How long to wait for a slave to fully transmit when doing a "read". You can modify this after calling "begin" void begin(int speed);
// Send a message right now, ignoring the schedule table. void send(uint8_t addr, const uint8_t* message,uint8_t nBytes,uint8_t proto=2);
// Receive a message right now, returns 0xff if good checksum, # bytes received (including checksum) if checksum is bad. uint8_t recv(uint8_t addr, uint8_t* message, uint8_t nBytes,uint8_t proto=2);
// Scheduler APIs
// Add an element to the schedule. To remove, either clear the whole thing, or remove it when it next plays void add(LinScheduleEntry& entry,uint16_t when=0) { entry.trigger = millis() + when; scheduler.push(entry); } void clear(void) { scheduler.clear(); } void loop();
};
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 11, 2019 18:33:37 GMT
Hi Admin.
The still dont works with shieldbuddy, The default init with Serial compile:
public: Lin(LIN_SERIAL& ser=Serial,uint8_t txPin=1); LIN_SERIAL& serial; uint8_t txPin; // what pin # is used to transmit (needed to generate the BREAK signal) int serialSpd; // in bits/sec. Also called baud rate uint8_t serialOn; // whether the serial port is "begin"ed or "end"ed. Optimization so we don't begin twice. unsigned long int timeout; // How long to wait for a slave to fully transmit when doing a "read". You can modify this after calling "begin" void begin(int speed);
but when i try to init the Lin lin(Serial1,16) or try to change the library to init whit other serial:
public: Lin(LIN_SERIAL& ser=Serial1,uint8_t txPin=16); LIN_SERIAL& serial; uint8_t txPin; // what pin # is used to transmit (needed to generate the BREAK signal) int serialSpd; // in bits/sec. Also called baud rate uint8_t serialOn; // whether the serial port is "begin"ed or "end"ed. Optimization so we don't begin twice. unsigned long int timeout; // How long to wait for a slave to fully transmit when doing a "read". You can modify this after calling "begin" void begin(int speed);
I get this init error:
exit status 1 invalid initialization of reference of type 'SerialClassRxTx&' from expression of type 'SerialClass2'
On Mega, uno, etc works great.
|
|
|
Post by Admin on Jan 11, 2019 20:06:35 GMT
Ok we will need to check this.
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 11, 2019 20:42:21 GMT
Thanks my friend, so far it compile only when I init the LIN on Serial with TX on pin 1:
Lin(LIN_SERIAL& ser=Serial,uint8_t txPin=1); // Compile OK no errors
For Serial1:
Lin(LIN_SERIAL& ser=Serial1,uint8_t txPin=16);
Error is:
exit status 1 invalid initialization of reference of type 'SerialClassRxTx&' from expression of type 'SerialClass2'
For Serial0:
Lin(LIN_SERIAL& ser=Serial0,uint8_t txPin=14);
Error is:
exit status 1 invalid initialization of reference of type 'SerialClassRxTx&' from expression of type 'SerialClass1'
I test SerialASC just to confirm the compile error, is this:
exit status 1 invalid initialization of reference of type 'SerialClassRxTx&' from expression of type 'SerialClass3'
Regards.
Hope this help, im ussing the example of the library to test the compile on all the serial and only work on the firs one.
|
|
|
Post by Admin on Jan 14, 2019 10:52:44 GMT
You will need to use the attached Variant.h to fix this problem.
Variant.h (25.03 KB)
This needs to be copied to:
C:\Program Files (x86)\Arduino\hardware\aurduino\aurix\variants\tc275
And;
C:\Program Files (x86)\Arduino\hardware\aurduino_Dx\aurix\variants\tc275
To use RX0/TX0 pins, in Lin.h, you need to add:
//#define LIN_SERIAL HardwareSerial /* Use ShieldBuddy serial class SerialClassRxTx */ #define LIN_SERIAL HardwareSerial0 /* Use ShieldBuddy serial class SerialClass1 */ //#define LIN_SERIAL HardwareSerial1 /* Use ShieldBuddy serial class SerialClass2 */
And then in the class definition in lin.h:
public: Lin(LIN_SERIAL& ser=Serial0,uint8_t txPin=14);
To use RX1/TX1 pins, in Lin.h, you need to add:
//#define LIN_SERIAL HardwareSerial /* Use ShieldBuddy serial class SerialClassRxTx */ //define LIN_SERIAL HardwareSerial0 /* Use ShieldBuddy serial class SerialClass1 */ #define LIN_SERIAL HardwareSerial1 /* Use ShieldBuddy serial class SerialClass2 */
And then in the class definition in lin.h:
public: Lin(LIN_SERIAL& ser=Serial1,uint8_t txPin=14);
We will include the change to Variant.h in the next ShieldBuddy release.
|
|
sinai1
Junior Member

Posts: 67
|
Post by sinai1 on Jan 14, 2019 18:51:55 GMT
Thanks, It compile, I will upload this as soon i get somecards, regards.
|
|
|
Post by Admin on Jan 14, 2019 20:25:27 GMT
It seems to transmit on serial0 and serial1!
|
|