tonton81 / ESP32_CAN

ESP32 CAN library based off of FlexCAN_T4
MIT License
10 stars 3 forks source link

Weird issues with not sending ISOTP packets #4

Closed AKCore closed 10 months ago

AKCore commented 1 year ago

So some of my ISOTP Packets are responding correctly but others are not, It seems like when there is less than 3 bytes or so to respond to it never sends that data. Is there a problem with my(horribly written) code that would cause this. Because i notice there is no ISOTP server for the ESP32_CAN library like there is in the FlexCan library.

See code attached.

#include <Arduino.h>
#include <ESP32_CAN.h>
#include <isotp.h>
isotp<RX_BANKS_16, 512> tp; /* 16 slots for multi-ID support, at 512bytes buffer each payload rebuild */

ESP32_CAN<RX_SIZE_256, TX_SIZE_16> Can1;
bool AlreadyPinged = false;

void HandleSID10(const ISOTP_data &config, const uint8_t *inbuf)
{
    if(inbuf[1] == 0x03)
    {
      //This response is blank
      Serial.println("Set Diag Mode 3");
      uint8_t buf[] = { 0x50, 0x03 };
      tp.write(config, buf, sizeof(buf));
    }
    else
    {
      Serial.println("Unsupported Diag Mode");
      uint8_t buf[] = {0x7F, 0x10, 0x31 };
      tp.write(config, buf, sizeof(buf));

    }

}