also it gives me engine light invalid data on can from bsi
#define CS_PIN_CAN0 10
#define CS_PIN_CAN1 9
#define CS_PIN_CAN0 10
#define CS_PIN_CAN1 9 [/ CODE]
You could have swapped 10 & 9 earlier (in the code)
You could have physically reversed two wires (Low & High) or not having isolated the pins under the DB9 connector making the bottom shield short-circuited to ground or swapped the CAN order on the shields (one is CAN2004 the other one the converted CAN) fixable by modifying the code as mentioned earlier.
Set debugGeneral to true and check the console to see few things [/ QUOTE]
hello i have checked the cards and connections that you mention here no shorts all connected correctly i am using two lots of code the one you posted last year which i saved and the raw code that is there now
10 and 9 have not been swapped if i use the old code i get clock but cant change language unless i change this line to 1
byte languageID = 0; // Default is FR: 0 - EN: 1 / DE: 2 / ES: 3 / IT: 4 / PT: 5 / NL: 6 / BR: 9 / TR: 12 / RU: 14
but then i cannot change language or units but clock is displayed
if i use the code in the link on github i have no clock display although every now and then it will display for a few seconds then dissapear
then after a while my check engine light comes on
i am really confused if someone could help me please nac install in 2012 c5x7
thank you
Thank you very much for answering, which program should I use to first identify these signals when pressing the buttons, we will leave the programming for later. Thank you and thus start.You may need to look at the frames sent to the Arduino from the BSI2004, when you push the buttons. Once you get the codes, modify your Arduino sketch to affect the observed frames to the correspond BSI2010 functions in the sketch (for the NAC). I admit I don't have such "complex" commands on the C3 A51 I upgraded thanks to the Lord and I didn't have to do so, using the famous "3 fingers on the NAC screen" to access the NAC menu.
@VLud[QUOTE = "VLud, post: 2608364, member: 108646"] Seriously stop spamming ...
I don't know your setup, you don't give any useful information rather than "it does not work", not even debug informations, what do you expect?
Depending on your shields you could have swapped CS_PINs earlier
Short-circuit or reversed CAN-BUS, not related to the sketch itself. [/ QUOTE]
very sorry do not intend to spam but do not understand arduino well when you say swapped cs pins or reverse can bus could you explain a little easier for me please
once again i am sorry no intention to spam
Hello, can you tell me if this software should be installed on arduino? And if it is the arduino can shield that I use for diagnosis? or in which I use for communications from can 2004 - can 2010? Thank you.The debug in the sketch is compatible with the Python script / soft of Alexandre Blin which is extremely useful to find moving bytes pressing a button
Yes & No, physical buttons must be wired to the Arduino directly and make appropriate CAN-BUS messages
/////////////////////
// Libraries //
/////////////////////
#include <EEPROM.h>
#include <SPI.h>
#include <Time.h>
#include <TimeLib.h>
#include <Wire.h>
#include <DS3232RTC.h> // https://github.com/PaulStoffregen/DS3232RTC
#include <mcp2515.h> // https://github.com/autowp/arduino-mcp2515 + https://github.com/watterott/Arduino-Libs/tree/master/digitalWriteFast
////////////////////
// Variables //
////////////////////
int buttonState = 0;
int lastButtonState = 0;
long lastDebounceTime = 0;
long buttonPushTime = 0;
long buttonSendTime = 0;
long debounceDelay = 100;
long lastTempWarning = 0;
bool tempWarningState = false;
void setup() {
//Initialize buttons - MENU/VOL+/VOL-
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
}
void loop() {
int tmpVal;
// Receive buttons from the car
if (((millis() - lastDebounceTime) > debounceDelay)) {
tmpVal = 0;
if (!digitalRead(4)) tmpVal += 0b001;
if (!digitalRead(5)) tmpVal += 0b010;
if (!digitalRead(6)) tmpVal += 0b100;
if(tmpVal != lastButtonState){
buttonPushTime = millis();
buttonSendTime = 0;
}
if((millis() - buttonPushTime) > 100){
switch(tmpVal){
case 0b001:
canMsgSnd.data[0] = 0x80;
canMsgSnd.data[1] = 0x00;
canMsgSnd.data[2] = 0x00;
canMsgSnd.data[3] = 0x00;
canMsgSnd.data[4] = 0x00;
canMsgSnd.data[5] = 0x02;
canMsgSnd.data[6] = 0x00;
canMsgSnd.data[7] = 0x00;
canMsgSnd.can_id = 0x122;
canMsgSnd.can_dlc = 8;
// Menu button
if(buttonSendTime == 0){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Menu");
}
lastDebounceTime = millis();
buttonSendTime = millis();
}
break;
case 0b010:
canMsgSnd.data[0] = 0x04; //Volume down
canMsgSnd.data[1] = 0x00;
canMsgSnd.data[2] = 0x00;
canMsgSnd.can_id = 0x21F;
canMsgSnd.can_dlc = 3;
// Menu button
if(buttonSendTime == 0){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Vol -");
}
lastDebounceTime = millis();
buttonSendTime = millis();
}else if(millis() - buttonPushTime > 800 && ((millis() - buttonPushTime < 2000 && millis() - buttonSendTime > 600) ||(millis() - buttonPushTime > 2000 && millis() - buttonSendTime > 350))){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Vol -");
}
buttonSendTime = millis();
lastDebounceTime = millis();
}
break;
case 0b100:
canMsgSnd.data[0] = 0x08; //Volume down
canMsgSnd.data[1] = 0x00;
canMsgSnd.data[2] = 0x00;
canMsgSnd.can_id = 0x21F;
canMsgSnd.can_dlc = 3;
// Menu button
if(buttonSendTime == 0){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Vol +");
}
lastDebounceTime = millis();
buttonSendTime = millis();
}else if(millis() - buttonPushTime > 800 && ((millis() - buttonPushTime < 2000 && millis() - buttonSendTime > 600) ||(millis() - buttonPushTime > 2000 && millis() - buttonSendTime > 350))){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Vol +");
}
buttonSendTime = millis();
lastDebounceTime = millis();
}
break;
case 0b110:
canMsgSnd.data[0] = 0x0C; //Mute
canMsgSnd.data[1] = 0x00;
canMsgSnd.data[2] = 0x00;
canMsgSnd.can_id = 0x21F;
canMsgSnd.can_dlc = 3;
// Menu button
if(buttonSendTime == 0){
CAN1.sendMessage( & canMsgSnd);
if (SerialEnabled) {
Serial.println("Mute");
}
lastDebounceTime = millis();
buttonSendTime = millis();
}
break;
default:
lastDebounceTime = millis();
}
}
lastButtonState = tmpVal;
}
tmpVal = RTC.temperature();
if(tmpVal / 4.0 > 80 && millis() - lastTempWarning > 30000){
canMsgSnd.data[0] = 0x80;
canMsgSnd.data[1] = 0xEA;
canMsgSnd.data[2] = 0x80;
canMsgSnd.data[3] = 0x00;
canMsgSnd.data[4] = 0x00;
canMsgSnd.data[5] = 0x00;
canMsgSnd.data[6] = 0x00;
canMsgSnd.data[7] = 0x00;
canMsgSnd.can_id = 0x1A1;
canMsgSnd.can_dlc = 8;
if (SerialEnabled) {
Serial.println("Arduino temp to high");
}
CAN1.sendMessage( & canMsgSnd);
tempWarningState = true;
lastTempWarning = millis();
}else if (tempWarningState && millis() - lastTempWarning > 8000){
canMsgSnd.data[0] = 0xFF;
canMsgSnd.data[1] = 0xEA;
canMsgSnd.data[2] = 0x00;
canMsgSnd.data[3] = 0x00;
canMsgSnd.data[4] = 0x00;
canMsgSnd.data[5] = 0x00;
canMsgSnd.data[6] = 0x00;
canMsgSnd.data[7] = 0x00;
canMsgSnd.can_id = 0x1A1;
canMsgSnd.can_dlc = 8;
if (SerialEnabled) {
Serial.println("Clear arduino temp to high");
}
CAN1.sendMessage( & canMsgSnd);
tempWarningState = false;
}
}