Has anyone managed to get SavvyCan to work with a Teensy 4.0?
i've have got it to sort of reading serial data but the Teensy is outputting ASCII and SavvyCan is converting it to HEX and thinking its just junk data. (i'm not sure of a way to output HEX rather than ASCII)
so i'm looking to create a log file using the teensy i can at least open in SavvyCan and kind of having a look through the data but i'm having problems with the Data of the can frame being shrunk into a single digit if it starts with a 0.
this is the teensy code i am using to output to serial currently (this will be written to a log file on an sd card eventully)
this is the current output to the serial monitor (Can ID 0x3C0 8 Data Bits should be 00 00 03 00 00 00 00 00)
this opens without errors but thinks there are only 4 Data Bits 00 30 00 00
so i'm wondering if there is a way to force it to display/log both HEX Bits
Thanks jon
i've have got it to sort of reading serial data but the Teensy is outputting ASCII and SavvyCan is converting it to HEX and thinking its just junk data. (i'm not sure of a way to output HEX rather than ASCII)
so i'm looking to create a log file using the teensy i can at least open in SavvyCan and kind of having a look through the data but i'm having problems with the Data of the can frame being shrunk into a single digit if it starts with a 0.
this is the teensy code i am using to output to serial currently (this will be written to a log file on an sd card eventully)
Code:
#include <FlexCAN_T4.h>
FlexCAN_T4<CAN1, RX_SIZE_256, TX_SIZE_16> can1;
FlexCAN_T4<CAN2, RX_SIZE_256, TX_SIZE_16> can2;
CAN_message_t msg;
void setup(void) {
can1.begin();
can1.setBaudRate(500000);
can2.begin();
can2.setBaudRate(500000);
}
void loop() {
if ( can1.read(msg) ) {
Serial.print("("); Serial.print(msg.timestamp); Serial.print(") ");
Serial.print("vcan0 "); Serial.print(msg.id, HEX);;
Serial.print("#");
for ( uint8_t i = 0; i < 8; i++ ) {
Serial.print(msg.buf[i], HEX);
}
Serial.println("");
}
else if ( can2.read(msg) ) {
Serial.print("CAN2 ");
Serial.print("MB: "); Serial.print(msg.mb);
Serial.print(" ID: 0x"); Serial.print(msg.id, HEX );
Serial.print(" EXT: "); Serial.print(msg.flags.extended );
Serial.print(" LEN: "); Serial.print(msg.len);
Serial.print(" DATA: ");
for ( uint8_t i = 0; i < 8; i++ ) {
Serial.print(msg.buf[i]); Serial.print(" ");
}
Serial.print(" TS: "); Serial.println(msg.timestamp);
}
}
this is the current output to the serial monitor (Can ID 0x3C0 8 Data Bits should be 00 00 03 00 00 00 00 00)
Code:
(52859) vcan0 3C0#00300000
(34638) vcan0 3C0#00300000
(16417) vcan0 3C0#00300000
(63732) vcan0 3C0#00300000
(45511) vcan0 3C0#00300000
(27290) vcan0 3C0#00300000
(9069) vcan0 3C0#00300000
(56384) vcan0 3C0#00300000
(38163) vcan0 3C0#00300000
(19942) vcan0 3C0#00300000
(1721) vcan0 3C0#00300000
(49036) vcan0 3C0#00300000
(30815) vcan0 3C0#00300000
(12594) vcan0 3C0#00300000
(59909) vcan0 3C0#00300000
(41688) vcan0 3C0#00300000
this opens without errors but thinks there are only 4 Data Bits 00 30 00 00
so i'm wondering if there is a way to force it to display/log both HEX Bits
Thanks jon