macchina / LIN

Arduino library to add dual LIN support on SAM3X based boards with a TJA1021/TJA1027 transceiver
MIT License
109 stars 48 forks source link

= instead == #1

Closed gioreva closed 5 years ago

gioreva commented 7 years ago

There are errors ? = instead ==

if(ch=2){
    PIOA->PIO_PER = PIO_PA13; // enable PIO register
    PIOA->PIO_OER = PIO_PA13; // enable PA13 as output
    PIOA->PIO_CODR = PIO_PA13; // clear PA13
    delayMicroseconds(del); // delay
    PIOA->PIO_SODR = PIO_PA13; // set pin high
    PIOA->PIO_PDR = PIO_PA13; // clear configuration for PIO, needs to be done because Serial wont work with it
}else if(ch=1){
    PIOA->PIO_PER = PIO_PA11; // enable PIO register
    PIOA->PIO_OER = PIO_PA11; // enable PA11 as output
    PIOA->PIO_CODR = PIO_PA11; // clear PA11
    delayMicroseconds(del); // delay
    PIOA->PIO_SODR = PIO_PA11; // set pin high
    PIOA->PIO_PDR = PIO_PA11; // clear configuration for PIO, needs to be done because Serial wont work with it
}
gioreva commented 7 years ago

I removed led by slave example, but does not compile.

Arduino:1.8.1 (Windows 7), Scheda:"Arduino/Genuino Zero (Native USB Port)"

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::write(byte, byte*, byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:85:3: error: 'Serial2' was not declared in this scope

   Serial2.begin(bound_rate); // config Serial

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::writeRequest(byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:109:3: error: 'Serial2' was not declared in this scope

   Serial2.begin(bound_rate); // config Serial

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::writeResponse(byte*, byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:132:3: error: 'Serial2' was not declared in this scope

   Serial2.begin(bound_rate); // config Serial

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::writeStream(byte*, byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:152:3: error: 'Serial2' was not declared in this scope

   Serial2.begin(bound_rate); // config Serial

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::setSerial()':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:165:3: error: 'PIOA' was not declared in this scope

   PIOA->PIO_PUER = PIO_PA10; // We need software Pull-Up because there is no hardware Pull-Up resistor

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:165:20: error: 'PIO_PA10' was not declared in this scope

   PIOA->PIO_PUER = PIO_PA10; // We need software Pull-Up because there is no hardware Pull-Up resistor

                    ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:167:3: error: 'Serial2' was not declared in this scope

   Serial2.begin(10417); // Configure Serial1

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:168:3: error: 'PIOA' was not declared in this scope

   PIOA->PIO_PUER = PIO_PA12; // We need software Pull-Up because there is no hardware Pull-Up resistor

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:168:20: error: 'PIO_PA12' was not declared in this scope

   PIOA->PIO_PUER = PIO_PA12; // We need software Pull-Up because there is no hardware Pull-Up resistor

                    ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::read(byte*, byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:187:6: error: 'Serial2' was not declared in this scope

   if(Serial2.read() != -1){ // Check if there is an event on LIN bus

      ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::readStream(byte*, byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:213:6: error: 'Serial2' was not declared in this scope

   if(Serial2.read() != -1){ // Check if there is an event on LIN bus

      ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::serial_pause(int)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:227:3: error: 'PIOA' was not declared in this scope

   PIOA->PIO_PER = PIO_PA13; // enable PIO register

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:227:19: error: 'PIO_PA13' was not declared in this scope

   PIOA->PIO_PER = PIO_PA13; // enable PIO register

                   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:234:3: error: 'PIOA' was not declared in this scope

   PIOA->PIO_PER = PIO_PA11; // enable PIO register

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:234:19: error: 'PIO_PA11' was not declared in this scope

   PIOA->PIO_PER = PIO_PA11; // enable PIO register

                   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::sleep(byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:246:13: error: 'PIOB' was not declared in this scope

   if(ch==1) PIOB->PIO_SODR = PIO_PB4; // Set PB4, high state, normal mode

             ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:246:30: error: 'PIO_PB4' was not declared in this scope

   if(ch==1) PIOB->PIO_SODR = PIO_PB4; // Set PB4, high state, normal mode

                              ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:247:13: error: 'PIOB' was not declared in this scope

   if(ch==2) PIOB->PIO_SODR = PIO_PB7; // Set PB7, high state, normal mode

             ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:247:30: error: 'PIO_PB7' was not declared in this scope

   if(ch==2) PIOB->PIO_SODR = PIO_PB7; // Set PB7, high state, normal mode

                              ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:249:13: error: 'PIOB' was not declared in this scope

   if(ch==1) PIOB->PIO_CODR = PIO_PB4; // Clear PB4, low state, sleep mode

             ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:249:30: error: 'PIO_PB4' was not declared in this scope

   if(ch==1) PIOB->PIO_CODR = PIO_PB4; // Clear PB4, low state, sleep mode

                              ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:250:13: error: 'PIOB' was not declared in this scope

   if(ch==2) PIOB->PIO_CODR = PIO_PB7; // Clear PB7, low state, sleep mode

             ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:250:30: error: 'PIO_PB7' was not declared in this scope

   if(ch==2) PIOB->PIO_CODR = PIO_PB7; // Clear PB7, low state, sleep mode

                              ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp: In member function 'int lin_stack::sleep_config(byte)':

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:258:3: error: 'PIOB' was not declared in this scope

   PIOB->PIO_PER = PIO_PB4; // enable PIO register on pin PB4

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:258:19: error: 'PIO_PB4' was not declared in this scope

   PIOB->PIO_PER = PIO_PB4; // enable PIO register on pin PB4

                   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:263:3: error: 'PIOB' was not declared in this scope

   PIOB->PIO_PER = PIO_PB7; // enable PIO register on pin PB7

   ^

D:\Documents\Arduino\libraries\LIN-master\lin_stack.cpp:263:19: error: 'PIO_PB7' was not declared in this scope

   PIOB->PIO_PER = PIO_PB7; // enable PIO register on pin PB7

                   ^

exit status 1
Errore durante la compilazione per la scheda Arduino/Genuino Zero (Native USB Port).

Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"
collin80 commented 7 years ago

The = instead of == issue is definitely valid. That code seems broken. So far I've just imported this library from someone else and haven't looked at it. I'll have to fix that problem. As for your errors in compiling - it is because you are attempting to compile for Arduino Zero but the code seems to be written specifically for an Arduino Due instead. It uses a lot of structures that exist on the Due but apparently do not for the Zero. That's going to be tough to fix.

ghislaingautier commented 6 years ago

Hello. I am trying to use it as LIN master with Arduino Uno. Did someone try it. @gioreva did you find a fix on Arduino Zero? what did you do.

gioreva commented 6 years ago

http://shop.gevaelettronica.it/index.php?id_product=14&controller=product&id_lang=1 My board is zero with lin controller. I'm using lin whithout library. Directly Serial.

ghislaingautier commented 6 years ago

Thank you for the quick response. i am trying to use a different lin shield for which i definitely need a LIN library. http://skpang.co.uk/catalog/linbus-breakout-board-p-1417.html i've not found yet a plug and play library which works as LIN master.

collin80 commented 5 years ago

The actual issue first raised here is now fixed.