collin80 / TeslaBMS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem getting code to compile

ahrenswett opened this issue · comments

@collin80 HI! First I want to say thank a ton for taking this on! Its invaluable and so glad I can use the existing board.

I am new to Arduino and C++ usually code in java so hopping you can help me get this going!
here is a link to the commit on my fork with the changes I made for my Due. My commit

I was able to get all the libraries you wrote included as that was first issue. Then I ran into this and changed from serial to USART that seemed to work or at least not error out

//Set to the proper port for your USB connection - SerialUSB on Due (Native) or Serial for Due (Programming) or Teensy
#define SERIALCONSOLE   Serial

//Define this to be the serial port the Tesla BMS modules are connected to.
//On the Due you need to use a USART port (Serial1, Serial2, Serial3) and update the call to serialSpecialInit if not Serial1
#define USART  Serial2

But now it is throwing an `error

In file included from sketch\BMSModule.cpp:3:0:
sketch\BMSUtil.h: In static member function 'static void BMSUtil::sendData(uint8_t*, uint8_t, bool)':
BMSUtil.h:37:16: error: request for member 'write' in '0', which is of non-class type 'int'
         SERIAL.write(addrByte);
                ^

Again thanks a ton for all your work!

Realized my error in changing to:
#define USART Serial2
changed to
#define SERIAL Serial1
then changed the call to serialSpecialInit in TeslaBMS to:
serialSpecialInit(USART1, BMS_BAUD)

Now top error has to do with externa EEPROMSettings settings;

now im having issues with due_wire not having a dependancy.
Where do I find the following dependancy?

// Include Atmel CMSIS driver
#include <include/twi.h>

https://github.com/collin80/due_wire
Got it. is it normal to get red messages about redefining SERIAL and than have it compile?

In file included from sketch\Logger.h:31:0,
                 from C:\Users\ahren\TeslaBmsDependancies\TeslaBMS\TeslaBMS.ino:7:
sketch\config.h:10:0: warning: "SERIAL" redefined [enabled by default]
 #define SERIAL  Serial1
 ^
In file included from C:\Users\ahren\Documents\ArduinoData\packages\arduino\hardware\sam\1.6.12\cores\arduino/Arduino.h:44:0,
                 from C:\Users\ahren\TeslaBmsDependancies\TeslaBMS\TeslaBMS.ino:6:
C:\Users\ahren\Documents\ArduinoData\packages\arduino\hardware\sam\1.6.12\cores\arduino/wiring_constants.h:43:0: note: this is the location of the previous definition
 #define SERIAL  0x0
 ^
C:\Users\ahren\TeslaBmsDependancies\TeslaBMS\TeslaBMS.ino: In function 'void loadSettings()':
C:\Users\ahren\TeslaBmsDependancies\TeslaBMS\TeslaBMS.ino:56:56: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         Logger::console("Resetting to factory defaults");
                                                        ^
C:\Users\ahren\TeslaBmsDependancies\TeslaBMS\TeslaBMS.ino:71:58: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
         Logger::console("Using stored values from EEPROM");
                                                          ^
Sketch uses 60916 bytes (11%) of program storage space. Maximum is 524288 bytes.
Atmel SMART device 0x285e0a60 found
Erase flash
done in 0.032 seconds

Write 63300 bytes to flash (248 pages)
[==============================] 100% (248/248 pages)
done in 12.176 seconds

Verify 63300 bytes of flash
[==============================] 100% (248/248 pages)
Verify successful
done in 11.179 seconds
Set boot flash true
CPU reset.

I don't seem to get that warning when compiling the code. I don't know where that's coming from. But, hopefully it works anyway.

I don't seem to get that warning when compiling the code. I don't know where that's coming from. But, hopefully it works anyway.
Got It! notice the light flashing as i was checking ports looks like the pins on the end of my wires for my breadboard were to thin to give a good connection on the header to the arduino. wiggled a bit and now its golden! got the menu after typing ?