Go Down

Topic: IDE update screwed up my libraries (Read 555 times) previous topic - next topic

keaton

this is the exact reason i did not want to update my IDE.... after updating form 0.22 to 1.0.3 my CAN bus library quit working and errored out, I'm getting sick of racking my brain on this...

My original Canbus.cpp had this
Code: [Select]
#include "WConstants.h" //for old IDE
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "pins_arduino.h"
#include <inttypes.h>
#include "global.h"
#include "mcp2515.h"
#include "defaults.h"
#include "Canbus.h"


Error:
Quote
Canbus.cpp:6:38: error: WConstants.h: No such file or directory

after searching online I was told I needed this
Code: [Select]
//#include "WConstants.h" //for old IDE
#include "Arduino.h" //added for arduino 1.0+
#include <stdio.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "pins_arduino.h"
#include <inttypes.h>
#include "global.h"
#include "mcp2515.h"
#include "defaults.h"
#include "Canbus.h"
#include <FILENAME.h> // add this for 1.0+ IDE


the next error pointed to my mcp2515.c
Code: [Select]
mcp2515.c:31:34: error: WConstants.h: No such file or directory
original code
Code: [Select]
#include <avr/io.h>
#include <util/delay.h>
#include "WConstants.h" //old IDE
#include "global.h"
#include "mcp2515.h"
#include "mcp2515_defs.h"
#include "defaults.h"


changed to
Code: [Select]
#include <avr/io.h>
#include <util/delay.h>
//#include "WConstants.h" //old IDE
#include "Arduino.h" //added for arduino 1.0+
#include <FILENAME.h> // add this for 1.0+ IDE
#include "global.h"
#include "mcp2515.h"
#include "mcp2515_defs.h"
#include "defaults.h"


everything being called in my .pde
Code: [Select]
//#include <NewSoftSerial.h>
#include <SoftwareSerial.h>
#include <Canbus.h>  // my CAN needed.
#include <Wire.h>
//NewSoftSerial mDVRRec(6, 7);  //serial for unit that records ***correct
SoftwareSerial mDVRRec(6, 7);


everything use to work before I upgraded to 1.0.3

I'm using the SPI bus & SCK is connected to pin13 (LED pin) and I can see it blipping on and off so something is trying, but i'm not getting any data on my LCD or Serial port even though the print commands are there

pYro_65

This is a bad choice for a file name if it does exist ( not part of Arduino ) :
Quote
#include <FILENAME.h>


The IDE appears to give warnings/errors on some missing headers but not all, verify the file names are correct. Read the documentation for the new libraries you are using/switching too. Also search the forum for other people with upgrade problems using those libs, good chance by now someone else has encountered the error ( if it is not specific to your code ).


keaton


This is a bad choice for a file name if it does exist ( not part of Arduino ) :
Quote
#include <FILENAME.h>


The IDE appears to give warnings/errors on some missing headers but not all, verify the file names are correct. Read the documentation for the new libraries you are using/switching too. Also search the forum for other people with upgrade problems using those libs, good chance by now someone else has encountered the error ( if it is not specific to your code ).



That's weird, now it complies with both of those commented out.... so i took it out the my car and fired it up still not working...
checked the data lines with an Oscope.. and they are wiggling..

here is the function code where i'm getting the data
Code: [Select]
void Get_CAN_Data(long *RPM, int *SPEED, int *EngineTemp, int *TPS, int *Drivers_Torque_Demand, int *Actual_Torque, int *Engine_Torque_Reference,int *Timing_Advance, int *Caculated_Load, int *Maf)
{
        //CAN Bus data collection
        if(Canbus.ecu_req(ENGINE_RPM,buffer) == 1){
          *RPM=atoi(buffer); //* changes what is stored
        }
        digitalWrite(A0, HIGH);// turns off LED
        if(Canbus.ecu_req(VEHICLE_SPEED,buffer) == 1){
            *SPEED=atoi(buffer); //* changes what is stored
        }
        if(Canbus.ecu_req(ENGINE_COOLANT_TEMP,buffer) == 1){
            *EngineTemp=atoi(buffer); //* changes what is stored
        }
        if(Canbus.ecu_req(THROTTLE,buffer) == 1){
            *TPS=atoi(buffer); //* changes what is stored
        } 
        if(Canbus.ecu_req(DRIVERS_TORQUE_DEMAND,buffer) == 1){ 
            *Drivers_Torque_Demand=atoi(buffer); //* changes what is stored
        }
         if(Canbus.ecu_req(ACTUAL_TORQUE,buffer) == 1){ 
             *Actual_Torque=atoi(buffer); //* changes what is stored
        }
        if(Canbus.ecu_req(ENGINE_TORQUE_REFERENCE,buffer) == 1){ 
            *Engine_Torque_Reference=atoi(buffer); //* changes what is stored
        }
        if(Canbus.ecu_req(TIMING_ADVANCE,buffer) == 1){ 
            *Timing_Advance=atoi(buffer); //* changes what is stored
        }
        if(Canbus.ecu_req(CALCULATED_ENGINE_LOAD,buffer) == 1){
            *Caculated_Load=atoi(buffer);
        }
        if(Canbus.ecu_req(MAF_SENSOR,buffer) == 1){
            *Maf=atoi(buffer);
        }
        digitalWrite(A0, LOW);// turns on LED

       
       
}


main
Code: [Select]

void loop (){
if(CAN_Connect == true)
  {
      Get_CAN_Data( &RPM,  &SPEED,  &EngineTemp,  &TPS,  &Drivers_Torque_Demand,  &Actual_Torque,   &Engine_Torque_Reference, &Timing_Advance, &Caculated_Load, &Maf);// "&" passes the address of input to the function
      //Serial_CAN_Print(RPM,  SPEED, EngineTemp, TPS,  Drivers_Torque_Demand,  Actual_Torque, Engine_Torque_Reference, Timing_Advance, Caculated_Load, Maf); // doesnt need "&" not editing data **** comment out this line later ***
     
     Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+4);Wire.write(itoa(RPM,buffer2,10)); Wire.endTransmission();
      /*Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+14);Wire.write(itoa(TPS,buffer2,10)); Wire.endTransmission();
      Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x40+12);Wire.write(itoa(Engine_Torque_Reference,buffer2,10)); Wire.endTransmission();
      delay(100);*/
}
}






pYro_65

If data is being sent wrong, the devices may be unresponsive. Maybe the can lib or whatever handles the transmission has extra initialisation steps, or maybe endianness needs switching.

By wiggling do you mean transmitting digital bits, or is it just noise on a voltage ( no discernible voltage changes that would register a 0, or 1 )

keaton


If data is being sent wrong, the devices may be unresponsive. Maybe the can lib or whatever handles the transmission has extra initialisation steps, or maybe endianness needs switching.

By wiggling do you mean transmitting digital bits, or is it just noise on a voltage ( no discernible voltage changes that would register a 0, or 1 )


the library i made use to work as is on version 0.22... on version 1.0.3 the same libraries, that use to work, don't work anymore..

by wiggling I mean changing state from high to low, low to high...

Quote

Code: [Select]


void loop (){
if(CAN_Connect == true)
  {
      Get_CAN_Data( &RPM,  &SPEED,  &EngineTemp,  &TPS,  &Drivers_Torque_Demand,  &Actual_Torque,   &Engine_Torque_Reference, &Timing_Advance, &Caculated_Load, &Maf);// "&" passes the address of input to the function
      //Serial_CAN_Print(RPM,  SPEED, EngineTemp, TPS,  Drivers_Torque_Demand,  Actual_Torque, Engine_Torque_Reference, Timing_Advance, Caculated_Load, Maf); // doesnt need "&" not editing data **** comment out this line later ***
     
     Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+4);Wire.write(itoa(RPM,buffer2,10)); Wire.endTransmission();
      /*Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+14);Wire.write(itoa(TPS,buffer2,10)); Wire.endTransmission();
      Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x40+12);Wire.write(itoa(Engine_Torque_Reference,buffer2,10)); Wire.endTransmission();
      delay(100);*/
}
}



May I suggest more conventional formatting? This is almost impossible to read.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

keaton


Quote

Code: [Select]


void loop (){
if(CAN_Connect == true)
  {
      Get_CAN_Data( &RPM,  &SPEED,  &EngineTemp,  &TPS,  &Drivers_Torque_Demand,  &Actual_Torque,   &Engine_Torque_Reference, &Timing_Advance, &Caculated_Load, &Maf);// "&" passes the address of input to the function
      //Serial_CAN_Print(RPM,  SPEED, EngineTemp, TPS,  Drivers_Torque_Demand,  Actual_Torque, Engine_Torque_Reference, Timing_Advance, Caculated_Load, Maf); // doesnt need "&" not editing data **** comment out this line later ***
     
     Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+4);Wire.write(itoa(RPM,buffer2,10)); Wire.endTransmission();
      /*Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x00+14);Wire.write(itoa(TPS,buffer2,10)); Wire.endTransmission();
      Wire.beginTransmission(lcd_addr);Wire.write(0xFE); Wire.write(0x45); Wire.write(0x40+12);Wire.write(itoa(Engine_Torque_Reference,buffer2,10)); Wire.endTransmission();
      delay(100);*/
}
}



May I suggest more conventional formatting? This is almost impossible to read.


i can change it for the sake of making it more readable for you (and other), but the way it is laid out is easier to read for me as it follows strings of data that make up 1 line...
i2c lines are like:  0x50, 0xFE,0x45,0x00,"data for that line", end... [address][CMD][CMD][parameter][data][end]


I think my problem may be my car... its a CAN car but it may be a special VW protocol where a 0x7DF address might not be the correct address for the ECU. This car has 21 nodes on the CAN bus..

Tomorrow i will test what i have on another CAN car/truck

Go Up