mjc506 wrote: ↑Thu Mar 10, 2022 2:01 pm
The teensy will definitely work (
https://github.com/collin80/TeensyRET) but you might need a couple more dupont cables for CAN high and low
[...]
Ah, here's the Teensy on the wiki:
https://openinverter.org/wiki/Getting_C ... Teensy_3.6 (I know yours is a 3.2, but it still has CAN0.
May need to adjust TeensyRET to not try opening CAN1?)
EDIT - no, CAN1 is enabled by a setting somewhere, looks like there's a config menu accessible over serial, or perhaps through Savvycan itself
I think I am pretty close but getting some errors whilst trying to compile the TeensyRET sketch in Arduino, so I figure I would share as both a cry out for help and also to demonstrate to those who may attempt this and come across something similar
this is the reason why I left SaavyCAN on Teensy for last as this cake has the most layers of complexity
=====================================================================================================
Arduino: 1.8.16 (Windows 10), TD: 1.55, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz (overclock), Faster, US English"
In file included from C:\Users\j1901\Downloads\TeensyRET\SerialConsole.h:32:0,
from C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:32:
Logger.h:58:
error: 'File' does not name a type
static File fileRef; //file we're logging to
^
TeensyRET:50:
error: 'SdFatSdio' does not name a type
SdFatSdio sd;
^
TeensyRET: In function 'void setup()':
TeensyRET:163:
error: 'sd' was not declared in this scope
if (!sd.begin())
^
TeensyRET:227: [color=#FF0000
]error: 'Can1' was not declared in this scope[/color]
Can1.begin(settings.CAN1Speed);
^
TeensyRET: In function 'void setPromiscuousMode()':
TeensyRET:275: warning: unused variable 'filter'
int filter;
^
TeensyRET: In function 'void sendFrameToUSB(CAN_message_t&, int)':
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:318:42: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf((char *)buff, "%08x", frame.id);
^
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:318:42: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:324:42: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf((char *)buff, "%03x", frame.id);
^
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:324:42: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
TeensyRET: In function 'void sendFrameToFile(CAN_message_t&, int)':
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:410:93: warning: format '%i' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf((char *)buff, "%i,%x,%i,%i,%i", millis(), frame.id, frame.ext, whichBus, frame.len);
^
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:410:93: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:410:93: warning: format '%i' expects argument of type 'int', but argument 3 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:410:93: warning: format '%x' expects argument of type 'unsigned int', but argument 4 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:426:74: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
sprintf((char *)buff, "%f R%i %x", millis() / 1000.0f, idBits, frame.id);
^
C:\Users\j1901\Downloads\TeensyRET\TeensyRET.ino:426:74: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'uint32_t {aka long unsigned int}' [-Wformat=]
TeensyRET:388: warning: unused variable 'temp'
uint8_t temp;
^
TeensyRET: In function 'void sendDigToggleMsg()':
TeensyRET:478:
error: 'Can1' was not declared in this scope
Can1.write(frame);
^
TeensyRET: In function 'void loop()':
TeensyRET:525: error: 'Can1' was not declared in this scope
if (Can1.available()) {
^
TeensyRET:742: error: 'Can1' was not declared in this scope
if (out_bus == 1) Can1.write(build_out_frame);
^
TeensyRET:850: error: 'Can1' was not declared in this scope
Can1.setListenOnly(true);
^
TeensyRET:855: error: 'Can1' was not declared in this scope
Can1.setListenOnly(false);
^
TeensyRET:864: error: 'Can1' was not declared in this scope
Can1.begin(build_int);
^
TeensyRET:877: error: 'Can1' was not declared in this scope
Can1.end();
^
TeensyRET:570: warning: enumeration value 'GET_DIG_INPUTS' not handled in switch
switch (state) {
^
TeensyRET:570: warning: enumeration value 'GET_ANALOG_INPUTS' not handled in switch
TeensyRET:570: warning: enumeration value 'GET_CANBUS_PARAMS' not handled in switch
TeensyRET:570: warning: enumeration value 'GET_DEVICE_INFO' not handled in switch
TeensyRET:496: warning: unused variable 'loops'
static int loops = 0;
^
TeensyRET:506: warning: unused variable 'temp16'
uint16_t temp16;
^
TeensyRET:507: warning: unused variable 'markToggle'
static bool markToggle = false;
^
In file included from C:\Users\j1901\Downloads\TeensyRET\SerialConsole.h:32:0,
from C:\Users\j1901\Downloads\TeensyRET\SerialConsole.cpp:29:
Logger.h:58: error: 'File' does not name a type
static File fileRef; //file we're logging to
^
In file included from C:\Users\j1901\Downloads\TeensyRET\Logger.cpp:27:0:
Logger.h:58: error: 'File' does not name a type
static File fileRef; //file we're logging to
^
Logger.cpp:35: error: 'File' does not name a type
File Logger::fileRef; //file we're logging to
^
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp: In static member function 'static void Logger::flushFileBuff()':
Logger.cpp:130: error: 'fileRef' was not declared in this scope
if (fileRef.write(filebuffer, fileBuffWritePtr) != fileBuffWritePtr) {
^
Logger.cpp:136: error: 'fileRef' was not declared in this scope
fileRef.sync(); //needed in order to update the file if you aren't closing it ever
^
C:\Users\j1901\Downloads\TeensyRET\SerialConsole.cpp: In member function 'void SerialConsole::handleLawicelCmd()':
SerialConsole.cpp:150: warning: unused variable 'buff'
char buff[80];
^
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp: In static member function 'static boolean Logger::setupFile()':
Logger.cpp:145: error: 'fileRef' was not declared in this scope
if (!fileRef.isOpen()) //file not open. Try to open it.
^
C:\Users\j1901\Downloads\TeensyRET\SerialConsole.cpp: In member function 'void SerialConsole::handleConfigCmd()':
SerialConsole.cpp:299: error: 'Can1' was not declared in this scope
Can1.begin(settings.CAN1Speed);
^
SerialConsole.cpp:307: error: 'Can1' was not declared in this scope
Can1.end();
^
SerialConsole.cpp:326: error: 'Can1' was not declared in this scope
Can1.begin(settings.CAN1Speed);
^
SerialConsole.cpp:354: error: 'Can1' was not declared in this scope
Can1.setListenOnly(true);
^
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp: In static member function 'static void Logger::file(const char*, ...)':
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp:244:43: warning: conversion lacks type at end of format [-Wformat=]
sprintf(buff, "%l", va_arg(args, long));
^
SerialConsole.cpp:358: error: 'Can1' was not declared in this scope
Can1.setListenOnly(false);
^
Logger.cpp:244: warning: too many arguments for format
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp:244:43: warning: conversion lacks type at end of format [-Wformat=]
Logger.cpp:244: warning: too many arguments for format
C:\Users\j1901\Downloads\TeensyRET\Logger.cpp: In static member function 'static void Logger::log(Logger::LogLevel, const char*, va_list)':
Logger.cpp:360: warning: enumeration value 'Off' not handled in switch
switch (level) {
^
SerialConsole.cpp:415: error: 'Can1' was not declared in this scope
handleCANSend(Can1, newString);
^
SerialConsole.cpp:257: warning: unused variable 'whichEntry'
unsigned char whichEntry = '0';
^
C:\Users\j1901\Downloads\TeensyRET\SerialConsole.cpp: In member function 'void SerialConsole::handleShortCmd()':
SerialConsole.cpp:608: warning: unused variable 'val'
uint8_t val;
^
'File' does not name a type
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.