morcibacsi / arduino_tss463_van Goto Github PK
View Code? Open in Web Editor NEWArduino TSS463/TSS461 VAN interface library
License: GNU General Public License v3.0
Arduino TSS463/TSS461 VAN interface library
License: GNU General Public License v3.0
Salut,
//tss46x_van_reader.ino
#include <SPI.h>
#include <itss46x.h>
#include <tss46x_van.h>
#include <tss463.h>
#include <tss461_intel.h>
#include <tss46x_with_serial.h>
uint8_t VAN_PIN = 7;
TSSPinSetup* pinSetup;
SPIClass* spi;
ITss46x* vanSender;
TSS46X_VAN* VANInterface;
uint8_t vanMessageLength;
uint8_t vanMessage[32];
uint8_t headerByte = 0x80;
uint8_t check = 0x00;
char incomingByte;
int a = 0;
int *b = &a;
void InitTss463()
{
// initialize SPI
spi = new SPIClass();//*spi
#ifdef ARDUINO_ARCH_AVR
// start spi on Arduino boards
spi->begin();
#endif
#ifdef ARDUINO_SAM_DUE
// start spi on Arduino boards
spi->begin();
#endif
#ifdef ARDUINO_ARCH_ESP32
// You can select which pins to use as SPI on ESP32 boards by passing the SCK, MISO, MOSI, SS as arguments (in this order) to the spi->begin() method
const uint8_t SCK_PIN = 25;
const uint8_t MISO_PIN = 5;
const uint8_t MOSI_PIN = 33;
VAN_PIN = 32;
spi->begin(SCK_PIN, MISO_PIN, MOSI_PIN, VAN_PIN);
#endif
// instantiate the VAN message sender for a TSS463
vanSender = new Tss463(VAN_PIN, spi);
}
void setup()
{
Serial.begin(500000);
delay(3000);
Serial.println("Arduino VAN bus monitor using TSS463C");
InitTss463();
//InitTss461();
//InitTssSerial();
VANInterface = new TSS46X_VAN(vanSender, VAN_125KBPS);
VANInterface->begin();
// Data read *VIN CAR* Exemple
// IDENTIFIER = 0XE24
/*
SOF: 0x0E
IDEN: 0xE24
COM: 0x08
DATA(0): 0x56
DATA(1): 0x45
DATA(2): 0x33
DATA(3): 0x38
DATA(4): 0x43
DATA(5): 0x52
DATA(6): 0x46
DATA(7): 0x52
DATA(8): 0x45
DATA(9): 0x38
DATA(10): 0x30
DATA(11): 0x30
DATA(12): 0x30
DATA(13): 0x30
DATA(14): 0x35
DATA(15): 0x34
DATA(16): 0x34
DATA(17): 0x69
DATA(18): 0xE6
EOF: 0xFF
*/
VANInterface->set_channel_for_receive_message(1, 0xE2, 23, 0); // It's Good ?
}
void loop() {
MessageLengthAndStatusRegister messageAvailable = VANInterface->message_available(1);
if (messageAvailable.data.CHRx || messageAvailable.data.CHTx || messageAvailable.data.CHER)
{
VANInterface->read_message(1, &vanMessageLength, vanMessage);
Serial.print("Channel: ");
Serial.print(1, DEC);
Serial.print(": ");
char tmp[3];
for (size_t i = 0; i < vanMessageLength; i++)
{
snprintf(tmp, 3, "%02X", vanMessage[i]);
Serial.print(" ");
Serial.print(tmp);
}
Serial.println();
VANInterface->reactivate_channel(1);
}
}
Hi, thanks for your awesome work on this library.
I am using the Arduino UNO, TSS463C + MCP2551. Read & Write works fine, but my Arduino Uno keeps restarting or hanging randomly. Can be a problem that my Arduino is not genuine? Or maybe memory issues?
Hi Peter,
I have been following your project for a while now. And was interested in recreating the circuit. I have opened up an old replacement Sagem PP-T40 clock (the one the can be found in Peugeot 206 from 2003). In it I found the TSS461C and the Alcatel 2840 (mine is designated as: 0217 REMQ. Is it possible to use these chips together? Or do I have to look for a TJA1040?
PS: Is Y1 a resonator or a oscillator?
Kind regards,
Rik
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.