morcibacsi / PSAVanCanBridgeHW

VAN - CAN protocol bridge hardware for cars made by PSA Group (Peugeot, Citroen)
GNU General Public License v3.0
23 stars 11 forks source link

CAN-converter? #5

Open WildeRNS opened 2 years ago

WildeRNS commented 2 years ago

Thanks for you work. Want to make such device, but have question: can I use SPI - CAN converter (MCP2515 and TJA1050)?: https://images.prom.ua/2447555310_w600_h600_2447555310.jpg or: https://images.prom.ua/2772277826_w640_h640_mcp2551-vysokoskorostnoj-high-speed.jpg Thanks

morcibacsi commented 2 years ago

To read/write on the VAN bus you need two things:

  1. a VAN controller
  2. a VAN transceiver

The transceiver is just a simple circuit for sending/receiving on a pair of wires. So it doesn't really know what he is doing it just converts electric signals. Therefore fortunately the VAN transceiver can be replaced with a CAN transceiver like a TJA1040/TJA1050/MCP2551 or something like these.

However the VAN controller is responsible to create the packets which will be sent to the transceiver. It knows how the packets should be built to meet the requirements the standard specifies. So this means that unfortunately you can't replace a VAN controller with a CAN controller as they are doing things differently.

WildeRNS commented 2 years ago

I have Peugeot 206 plus car and android head unit. I want to replace my original display with android (include can-bus adapter), so I don't need to send van-packages, only receive (e.g.: information such as opened doors, turned lights, and so on).

morcibacsi commented 2 years ago

Well... if you wish to remove the original display from the car, then you need to send packets on the VAN bus, because for some data the display is the initiator of the data-exchange. The fuel consumption data, and the door open statuses is such a message (they are both in the same data frame). So if you remove the original display, there will be nothing to initiate the data transfer, so the data won't be there on the bus (so nothing to receive). So if you can't obtain a TSS463, then you need to keep your original display (reroute its wiring to the glovebox, or somewhere below the dashboard). In this case you can get away with my v1.1 bridge which can receive the frames (but that can't send).

mbprado commented 2 years ago

To add some light to someone who has troubles finding TSS463: it can be found inside RD3 radios and can be bought practically everywhere for few bucks...

karolp1993 commented 1 year ago

To add some light to someone who has troubles finding TSS463: it can be found inside RD3 radios and can be bought practically everywhere for few bucks...

Or in even cheaper 307 instrument cluster ;)

BatmanJMF commented 11 months ago

hello, I am a novice for the PSA VAN-CAN protocol bridge what is ESP32 used for?

Best regards.

morcibacsi commented 11 months ago

hello, I am a novice for the PSA VAN-CAN protocol bridge what is ESP32 used for?

Best regards.

The ESP32 board has the microcontroller which contains the software used to translate the VAN bus messages to CAN.

BatmanJMF commented 11 months ago

hello, If I understand correctly the card cannot work without ESP 32? In fact I have a car in VAN protocol with a car radio that I changed with a tablet which has a CanBus box. My dashboard is a Christmas tree. I wanted to put this box to translate the VAN protocol into CAN.

Best regards,

karolp1993 commented 11 months ago

ESP32 is mandatory. Is main processing unit in this board. If you have some aftermarket radio with CANbox dedicated to Peugeot with CAN bus, you can connect Peter's adapter to canbox adapter and it should work.

BatmanJMF commented 11 months ago

Sorry, what is the adapter Peter? I can't find it on the internet.

Best regards,

karolp1993 commented 11 months ago

Peter's adapter I mean this VAN-CAN adapter

BatmanJMF commented 11 months ago

Good morning, I'm still looking for a solution for my tablet problem on my 307CC. I would like to make your Can Van adapter "PSAVanCanBridge". I don't think I have any problem making your Can Van adapter "PSAVanCanBridge"(hardware). On the other hand, I have been trying for two days to compile your program for the ESP 32 and I am encountering a problem with the "BluetoothSerial.cpp" file, it is giving me errors. I downloaded the latest versions of the "PSAVanCanBridge" file. I have a little notion of programming but that is well beyond my skills. I'm attach the Arduino error message. Erreur.txt. Can you help me ? Thanks

morcibacsi commented 11 months ago

Please compile it using platformio. There are so many versions of the esp32 platform and the required libraries that it is an endless battle to support compiling from Arduino. Every user has a different setup with different libraries it is impossible to support that.

karolp1993 commented 11 months ago

And use main, not master branch

BatmanJMF commented 11 months ago

Hello, Thanks for your help I was finally able to compile the program. Happy New Year everyone.

BatmanJMF commented 9 months ago

Bonjour, J'ai enfin eu le temps de fabriquer le PSAVanCanBridgeHW-1.4 et je l'ai interfacé avec le boitier canbus fournir avec la tablette et pour l'instant ca fonctionne sans faire planter mon tableau de bord. Je voulais vous remercier pour votre aide elle ma été d'une grande utilité. J'ai pris la version simple du PSAVanCanBridgeHW-1.4 et j'aimerais encore essayer de réduire ca taille car ca me fait deux boitier a garder. Pour cela je voulais savoir si il était possible de remplacer les deux MCP 2551 avec par exemple un MCP25612FD-E/SL ? Et si on pouvais remplacer la carte électronique ESP32 par simplement le circuit intégrer ESP32-U4WDH en la programment avec un convertisseur USB?

karolp1993 commented 9 months ago

Should be doable.

morcibacsi commented 9 months ago

It is possible to use that CAN transceiver. Version 1.4 of the board was designed with components which are easy to obtain, and easy to solder by hand. But this way it is fairly large. Actually it is stuck in kind of a prototype phase. I have a similar project which is a dual-CAN board here: PSACANBridge

Based on that board I am in the middle of redesigning the VAN-CAN bridge board. It will look very similar to this:

image

The board won't really be smaller (actually the base dimensions are roughly the same as v1.4 so about 70x45mm). But it will contain a better step down converter, and a real time clock module (optional) to have support for the newer CAN protocol where the time and date is distributed on the CAN bus by the BSI. Also it is very likely that the TSS463 won't be needed but that we will see when I have the first batch of the PCB. Also the new board will be made with 0603 sized components so hand soldering won't really be an option (unless you are very good at soldering). So it will be recommended to order with assembly service. I use JLCPB so when choosing the components I am quite stuck with what they have in stock here: https://jlcpcb.com/parts

BatmanJMF commented 9 months ago

En fait l'esp 32 est très complet wifi, Bluetooth, plein d'entrée/sortie mais quand j'ai regardé les pin de l'ESP 32 qu'on utilise sur le PSAVanCanBridge je m'aperçoit quand version simple on a que 10 pins environ sur 30 qu'on utilise. Moi le Bluetooth wifi ne me sont pas d'utilité. De plus une fois la puce programmer tous le système de convertisseur usb ne serve plus donc pourquoi le garder sur le pcb Je suis pas fan en automobile des cartes qui ne sont pas souder au pcb risque de mauvais connexion (vibration, écart de température). J'ai commencé à faire des recherches sur la puce ESP 32 pour l'utiliser avec seulement les fonctions utile pour le PSAVanCanBridge en enlevant tous le super flux. Je suis un bricoleur du dimanche mes connaissances en électronique sont basic. Je vois sur la platine que vous avez souder le convertisseur analogique bidirectionnel 4 canaux directement sur PCB ca c'est justement ce que je voudrais faire. Je recherche de l'aide pour savoir ce qui faut au minimum comme électronique pour faire fonctionner l'esp32 en ca version la plus simple (j'ai déjà vu qui fallait mettre un régulateur de tension 3,3 volt). Donc si vous pouvez m'aider je suis preneur merci.

karolp1993 commented 9 months ago

Try to find application note then

BatmanJMF commented 9 months ago

Bonjour Mr morcibacsi,, J'ai vu hier que vous aviez réussi avec une carte ESP32 avec les sorties TX2 et RX2 brancher directement sur la tablette de supprimer le boîtier raize pour les fonctions de la télécommande, mais vous aviez précisé que le boîtier raise avec plus de fonctionnalité un +12V pour le +ACC, +12V pour la caméra arrière et le +12V pour la l'éclairage de la tablette etc. Serais t'il possible de programmer l'ESP32 qui est sur le PSAVanCanBridge avec les code can pour commander des sortie de l'esp32 pour piloté un transistor mosfet pour chaque fonction pour ce passer de ce boîtier raise qui pose problème ? Est ce vous qui avez crée le programme de l'esp32 du PSAVanCanBridge car dans tous les forums on nous renvoie a vous et si oui pourriez vous modifier le programme pour rajouter ces fonctions car la ca dépasse complétement mes compétences ?

morcibacsi commented 9 months ago

I don't have plans to design a new hw and sw especially one which is readily available. A box for Android to interface the VAN bus can be bought from aliexpress: https://www.aliexpress.com/item/1005003413292076.html Even if I made such a device I sold my Android head unit years ago, so I couldn't test it.

As for the minimal setup I recommend searching the official ESP32 pages for a reference design. But you can't really shrink the board as you might noticed it requires a quite a bit of components. Even if you leave out the USB-TTL IC you need to add reset/boot switches (or at least points), connectors to upload the firmware, the 3.3V voltage regulator with its component, it is trickier than it seems at the first glimpse. Also it will be much more expensive than getting a ready-made devboard. On latest designs I used an ESP32-C3 SuperMini and ESP32-S3 Zero boards. These chips doesn't require a USB-TTL IC so they are a lot smaller than the devboard I used on my VAN-CAN bridge. They have castellated holes which makes it very neat to include on "motherboards" like I shown you previously (that used a ESP32-C3 SuperMini).

This is a ESP32-S3 Zero board, it has dimensions of 18 mm x 23.5 mm, you can't really make it smaller on your own.

image

BatmanJMF commented 8 months ago

Bonjour; Merci pour l'info de l'esp32-S3 zéro en effet c'est plus simple vu le prix d'acheter cette carte plutôt que d'intégré un circuit intégré ESP32. J'ai regardé le programme PSAVANCANBRIDGE pour pourvoir changer les affectations des pins pour l'ESP32-S3 zéro, mais je n'ai pas trouvé dans le programme l'affectation de la pin IRQ D19 GPI019 et la pin VAN TX D13 GPI013 pour pouvoir la changer. Est ce que ca veut dire qu'on est pas obligé de les brancher à la carte ESP32 ?

morcibacsi commented 8 months ago

VAN IRQ and VAN TX aren't used. They were connected on the PCB for future use, but turned out to be unnecessary.

BatmanJMF commented 8 months ago

Bonjour, Je viens de recevoir ma carte ESP32-S3 ZERO et j'ai voulu télécharger le programme PSAVANCANBRIDGE et comme je le pensais ca me met une erreur Bluetooth ca serais trop simple sinon. J'ai cherché sur internet et si j'ai bien compris le Bluetooth de l'ESP32-S3 ZERO serais un Bluetooth low energy alors que le Bluetooth ESP32-WROOM 32 serais un Bluetooth classique. Donc pour aller au plus simple j'ai désactivé le Bluetooth et la ça fonctionne. Je voulais savoir si de désactiver le Bluetooth avait une conséquence sur le programme ou si il sert juste pour une connexion avec le téléphone auquel cas cette fonction ne m'intéresse pas ?

Cordialement,

karolp1993 commented 8 months ago

Bluetooth is only for debugging purposes.

BatmanJMF commented 7 months ago

Bonjour, J'ai installé l'esp32-S3 sur le PCB PSAVANCANBRIDGE en mettant "board = esp32-s3-devkitc-1" et réaffecter les pins dans le programme. Le programme se téléverse bien mais ca ne fonctionne pas avec la tablette alors que ca fonctionne avec la carte DOIT ESP32 DEVKIT V1. Quand je branche ma carte esp32-S3 dans arduino il me dit que c'est une carte "TAMC Termod S3". J'ai changé les paramètres dans le fichier platformio.ini et là il me met une erreur à la compilation. Est ce important de mettre "board = TAMC Termod S3" au lieu de "board = esp32-s3-devkitc-1" et est ce que c'est ça qui fait que ca fonctionne pas avec ma tablette ?

morcibacsi commented 7 months ago

I am not familiar with that board, and you didn't mentioned what kind of errors do you have. But after a quick google search I found this: https://docs.platformio.org/en/stable/boards/espressif32/tamc_termod_s3.html which mentions that in the board you need to set tamc_termod_s3 However take note even if you set the correct board type, you might face some other compiler errors as the esp framework is constantly changing and for new boards there might be other adjustments needed (for example for my CAN2004 - CAN2010 bridge using the esp32-c3 I needed to modify the ESP CAN driver to include twai.h instead of can.h and make some other adjustments since they renamed a few things)

BatmanJMF commented 7 months ago

Bonjour, Je connais ce lien et j'ai effectué les modifications dans le fichier platformio.ini. Je sais pas si vous pourrez me répondre mais qu'est ce qui détermine qu'elle modèle de ESP32-S3 on à. Sur le site expressif il y a plein de ESP32-S3 Example "tamc_termod_s3", Espressif ESP32-S3-DevKitM-1, DFRobot Roméo ESP32-S3? je vous joins le message d'erreur que j'ai quand compile le programme avec "tamc_termod_s3" Erreur.txt

morcibacsi commented 7 months ago

I created a new branch: https://github.com/morcibacsi/PSAVanCanBridge/tree/multi_board_support

You can set the target type in platformio.ini by commenting and removing the comment on lines 14 and 15. https://github.com/morcibacsi/PSAVanCanBridge/blob/multi_board_support/platformio.ini#L14

After that you need to modify BoardConfig_ESP32_tamc_termod_s3.h file according to your pin setup. https://github.com/morcibacsi/PSAVanCanBridge/blob/multi_board_support/PSAVanCanBridge/BoardConfig_ESP32_tamc_termod_s3.h

BatmanJMF commented 7 months ago

Bonjour, J'ai téléversé votre nouveau programme dans l'ESP32-S3 sans aucun problème. Malheureusement ca ne pilote pas ma tablette. J'ai téléversé votre nouveau programme dans esp32doit-devkit-v1 et malheureusement ca ne fonctionne pas non plus avec ma tablette. Savez vous pourquoi ? Je vous joins un message d'alerte dans le programme mais je pense pas que le problème vienne de la. Message d'alerte.txt

romawkafor commented 7 months ago

Hello, I am planning to make a v1.4 board, but unfortunately we do not have a place to buy a controller in Ukraine: TSS463C. Can I use a version 1.1 board and what will I run into if I use an older version?

Thank you Advance for your Replay.

karolp1993 commented 7 months ago

Hello, I am planning to make a v1.4 board, but unfortunately we do not have a place to buy a controller in Ukraine: TSS463C. Can I use a version 1.1 board and what will I run into if I use an older version?

Thank you Advance for your Replay.

You can get TSS463C from cluster or central display

romawkafor commented 7 months ago

Thanks for the tip, I'll keep that in mind. But I still want to know what is the functional difference between 1.1 and 1.4 version, and is the program for esp32 different for 1.1 and 1.4 version of the board?

morcibacsi commented 6 months ago

@romawkafor To retrieve the consumption data and the door statuses from the car the TSS463 is needed as it makes it possible to send the query frame on the VAN bus. If you can't find a TSS463 an alternative solution is to just hide the original display behind the dashboard somewhere. In that case you can use 1.1 or 1.4 without the TSS463 installed.

romawkafor commented 6 months ago

@morcibacsi Thank you for the honor of receiving your reply. In my opinion, you have done a great job and also shared it with the community. Thank you for that. I found this chip on taobao.com. Awaiting delivery. True, there are several modifications: TSS463, TSS463C, TSS463C-E9. I couldn't find a document describing the differences, but I ordered one like yours, TSS463.

BatmanJMF commented 4 months ago

@morcibacsi Bonjour, j'ai lu sur un autre post du forum que dans le fichier config.h il fallait inscrire le VIN du véhicule. Je voulais savoir si c'est toujours d'actualité sur la version 1.4 du PSAVANCANBRIDGE ? Merci

morcibacsi commented 4 months ago

@BatmanJMF If you use the main branch of the software, it has a captive portal where you can set the VIN.