-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Van communication #2
Comments
Hi, it probably is possible, but I don't own any other cars so I'm not able to do this myself. |
Ok, I have Peugeot 206 so if you want to add this functionality I can check and debug your software :) Additionally, I found the VAN description on http://pinterpeti.hu/psavanbus/PSA-VAN.html |
To support the VAN bus an additional IC is required (TSS463) you can see a few sample schematics in my repo: https://github.com/morcibacsi/arduino_tss463_van To emulate a CDC on the VAN bus, alI you need is a few lines of code. Here is an Arduino sample code, which uses my TSS463 library (not the latest version, but I am happy to help converting it to the up to date version if needed): #include "VanMessageSender.h"
const int VAN_PIN = 7;
AbstractVanMessageSender *VANInterface;
unsigned long currentTime = millis();
unsigned long previousCdcTime = millis();
volatile uint8_t seconds = 0;
volatile uint8_t headerByte = 0x80;
void IncrementHeader()
{
if (headerByte == 0x87)
{
headerByte = 0x80;
}
else
{
headerByte++;
}
}
void IncrementSeconds()
{
seconds++;
if (seconds == 60)
{
seconds = 0;
}
}
uint8_t DecToBcd(uint8_t input)
{
return( (input/10*16) + (input%10) );
}
void AnswerToCDC()
{
uint8_t status = 0xC3; //playing
uint8_t cartridge = 0x16;
uint8_t minutes = 0x01;
uint8_t trackNo = 0x17;
uint8_t cdNo = 0x02;
uint8_t trackCount = 0x21;
uint8_t packet[12] = { headerByte, 0x00, status, cartridge, minutes, DecToBcd(seconds), trackNo, cdNo, trackCount, 0x3f, 0x01, headerByte };
VANInterface->set_channel_for_immediate_reply_message(0, 0x4EC, packet, 12);
}
void setup(){
VANInterface = new VanMessageSender(VAN_PIN);
VANInterface->begin();
}
void loop() {
currentTime = millis();
if (currentTime - previousCdcTime >= 1000)
{
previousCdcTime = currentTime;
IncrementSeconds();
IncrementHeader();
AnswerToCDC();
}
} |
I see, thanks for the answer. This is obviously possible, but would require a major code refactor, as well as a notable hardware change. CDCEmu depends highly on the CDC commands sent by the radio/display, so that would need to be implemented as well. I'm planning to build a new version anyway, based on ESP32 with built-in Bluetooth, better quality, etc, and single-boarded. Thus, the code would need to be rewritten as well. I'm planning to do a more universal and abstracted architecture of "sources" (Bluetooth, AUX, etc) and the output protocols (CAN RD4, VAN for example, and since I have a 2006 Golf as well it could help to emulate CDC there). To be honest, I do not have any ETA for that. There's just too much work around other projects, college and stuff. For now CDCEmu "works" so it's sadly pushed to a lower priority. I hope you can understand that. |
It is possible to add VAN communication for older PSA cars ? I mean for example PEUGEOT 206 ?
The text was updated successfully, but these errors were encountered: