ESP-IDF VAN bus writer library utilizing the ESP32-C6 ULP LP-Core. The aim of this library is to provide a software based solution to safely write to the VAN bus without a TSS463 or a TSS461 IC. Eventually these are going to be hard to obtain and the only option will be salvaging them from a used radio or BSI.
- Support for 125kbps bus (VAN COMFORT bus)
- Bus arbitration logic to safely write on the bus
- Sending "normal" type frames and "reply request" frames
- Support for 62.5kbps bus (VAN BODY bus)
- Support to reply ACK for frames
- Support in-frame reply frames
There is no plan to extend the library to read the VAN bus. For that you can use my VAN bus reader library using the RMT peripheral. You can use both libraries using the same rx pin.
The schematics below can be used to connect to a VAN bus. The SN65HVD230 is a CAN bus transceiver. You can use other CAN bus transceivers as well. Some examples: MCP2551, TJA1042, TJA1050, TJA1051, TJA1052. Note that some of these are 5V devices therefore a logic level converter to 3.3V should be used.
#include "LpCoreVanTx.hpp"
#define VAN_RX_PIN GPIO_NUM_3
#define VAN_TX_PIN GPIO_NUM_2
LpCoreVanTx* vanTx;
vanTx = new LpCoreVanTx(VAN_RX_PIN, VAN_TX_PIN, LpCoreVanTx::LP_VAN_NETWORK_SPEED::LP_VAN_125KBPS);
vanTx->Start();
// Send a normal frame
uint8_t packet[7] = { 0x0F, 0x07, 0x81, 0x1D, 0xA4 ,0x93, 0x56 };
if (vanTx->IsTxPossible())
{
vanTx->SendNormalFrame(0x8A4, packet, sizeof(packet), false);
}
if (vanTx->IsTxPossible())
{
// Send a query type frame
ulpVanTx->SendReplyRequestFrame(0x564);
}