ESP32CAN missing messages.
Posted: Mon Dec 09, 2019 11:45 pm
Hi - I am a complete newbie to ESP32. Please HELP !
My task has been to capture on an Chrysler Automotive Can Bus.
I am able to monitor messages on the bus. I use a diagnostic tool to initiate a "dump" of data and the ESP32 to monitor the packets.
Problem is - some of the message packages are missing :
Can anyone help as to why I am missing messages ?? Thank You !!!
I am using Arduino ver1.8.10
I have ESP-Wroom-32 board.
SND65HVD230 transceiver.
I choose arduino "board" - DOIT ESP32 DEVKIT V1.
ESP32 is power from USB 2.0 port connected to Notebook
Can bus speed set at 500kbps and serial monitor set at 500,000 baud
The Arduino code is as follows. I used the sample "esp32can-basic.ino" , added a blink to show me that the program loads and also removed any "send" lines.
THANK YOU for Reading this !
#include <Arduino.h>
#include <ESP32CAN.h>
#include <CAN_config.h>
CAN_device_t CAN_cfg; // CAN Config
unsigned long previousMillis = 0; // will store last time a CAN Message was send
const int interval = 1000; // interval at which send CAN Messages (milliseconds)
const int rx_queue_size = 10; // Receive Queue size
int ledPin = 2;
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(ledPin, LOW);
delay(1000);
Serial.begin(500000);
Serial.println("");
Serial.println("Basic Demo - ESP32-Arduino-CAN ACG 5");
CAN_cfg.speed = CAN_SPEED_500KBPS;
CAN_cfg.tx_pin_id = GPIO_NUM_5;
CAN_cfg.rx_pin_id = GPIO_NUM_4;
CAN_cfg.rx_queue = xQueueCreate(rx_queue_size, sizeof(CAN_frame_t));
// Init CAN Module
ESP32Can.CANInit();
}
void loop() {
CAN_frame_t rx_frame;
unsigned long currentMillis = millis();
// Receive next CAN frame from queue
if (xQueueReceive(CAN_cfg.rx_queue, &rx_frame, 3 * portTICK_PERIOD_MS) == pdTRUE) {
if (rx_frame.FIR.B.FF == CAN_frame_std) {
printf("New standard frame");
}
else {
printf("New extended frame");
}
if (rx_frame.FIR.B.RTR == CAN_RTR) {
printf(" RTR from 0x%08X, DLC %d\r\n", rx_frame.MsgID, rx_frame.FIR.B.DLC);
}
else {
printf(" from 0x%08X, DLC %d, Data ", rx_frame.MsgID, rx_frame.FIR.B.DLC);
for (int i = 0; i < rx_frame.FIR.B.DLC; i++) {
printf("0x%02X ", rx_frame.data.u8);
}
printf("\n");
}
}
// // Send CAN Message
// if (currentMillis - previousMillis >= interval) {
// previousMillis = currentMillis;
// CAN_frame_t tx_frame;
// tx_frame.FIR.B.FF = CAN_frame_std;
// tx_frame.MsgID = 0x001;
// tx_frame.FIR.B.DLC = 8;
// tx_frame.data.u8[0] = 0x00;
// tx_frame.data.u8[1] = 0x01;
// tx_frame.data.u8[2] = 0x02;
// tx_frame.data.u8[3] = 0x03;
// tx_frame.data.u8[4] = 0x04;
// tx_frame.data.u8[5] = 0x05;
// tx_frame.data.u8[6] = 0x06;
// tx_frame.data.u8[7] = 0x07;
// ESP32Can.CANWriteFrame(&tx_frame);
// }
}
SAMPLE of the data collected follows: I have manually entered the decoded data beside each message. blank lines I have inserted to show that lines are missing and the data expected. The dump is over 100,000 messages.
7E8 8 23 0 0 0 0 0 0 0
7E8 8 24 0 0 1 6 0 0 0
7E8 8 26 43 6F 70 79 72 69 67 Copyrig
7E8 8 27 68 74 20 32 30 30 37 ht 2007
Daimler
7E8 8 29 20 43 68 72 79 73 6C Chrysl
er LLC.
7E8 8 2B 20 41 6C 6C 20 52 69 All Ri
ghts Re
7E8 8 2D 73 65 72 76 65 64 2E served.
7E8 8 2F 6F 66 74 77 61 72 65 oftware
7E8 8 22 65 6E 74 69 61 6C 20 ential
7E8 8 24 70 72 69 65 74 61 72 prietar
7E8 8 26 72 74 79 20 6F 66 20 rty of
Chrysle
7E8 8 28 72 20 4C 4C 43 2E 20 r LLC.
7E8 8 2A 68 74 20 6E 6F 74 69 ht noti
7E8 8 2C 72 65 63 61 75 74 69 recauti
7E8 8 2E 6E 64 20 64 6F 65 73 nd does
7E8 8 20 70 6C 79 20 70 75 62 ply pub
7E8 8 22 6E 2E 0 0 1C B 21
7E8 8 24 0 0 1C B 21 5 2
7E8 8 26 1C B 22 5 2 0 1C
7E8 8 27 B D8 2 0 0 1C B
7E8 8 29 1 0 0 1C B 14 5
As you can see , several lines are missing.
My task has been to capture on an Chrysler Automotive Can Bus.
I am able to monitor messages on the bus. I use a diagnostic tool to initiate a "dump" of data and the ESP32 to monitor the packets.
Problem is - some of the message packages are missing :
Can anyone help as to why I am missing messages ?? Thank You !!!
I am using Arduino ver1.8.10
I have ESP-Wroom-32 board.
SND65HVD230 transceiver.
I choose arduino "board" - DOIT ESP32 DEVKIT V1.
ESP32 is power from USB 2.0 port connected to Notebook
Can bus speed set at 500kbps and serial monitor set at 500,000 baud
The Arduino code is as follows. I used the sample "esp32can-basic.ino" , added a blink to show me that the program loads and also removed any "send" lines.
THANK YOU for Reading this !
#include <Arduino.h>
#include <ESP32CAN.h>
#include <CAN_config.h>
CAN_device_t CAN_cfg; // CAN Config
unsigned long previousMillis = 0; // will store last time a CAN Message was send
const int interval = 1000; // interval at which send CAN Messages (milliseconds)
const int rx_queue_size = 10; // Receive Queue size
int ledPin = 2;
void setup() {
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(ledPin, LOW);
delay(1000);
Serial.begin(500000);
Serial.println("");
Serial.println("Basic Demo - ESP32-Arduino-CAN ACG 5");
CAN_cfg.speed = CAN_SPEED_500KBPS;
CAN_cfg.tx_pin_id = GPIO_NUM_5;
CAN_cfg.rx_pin_id = GPIO_NUM_4;
CAN_cfg.rx_queue = xQueueCreate(rx_queue_size, sizeof(CAN_frame_t));
// Init CAN Module
ESP32Can.CANInit();
}
void loop() {
CAN_frame_t rx_frame;
unsigned long currentMillis = millis();
// Receive next CAN frame from queue
if (xQueueReceive(CAN_cfg.rx_queue, &rx_frame, 3 * portTICK_PERIOD_MS) == pdTRUE) {
if (rx_frame.FIR.B.FF == CAN_frame_std) {
printf("New standard frame");
}
else {
printf("New extended frame");
}
if (rx_frame.FIR.B.RTR == CAN_RTR) {
printf(" RTR from 0x%08X, DLC %d\r\n", rx_frame.MsgID, rx_frame.FIR.B.DLC);
}
else {
printf(" from 0x%08X, DLC %d, Data ", rx_frame.MsgID, rx_frame.FIR.B.DLC);
for (int i = 0; i < rx_frame.FIR.B.DLC; i++) {
printf("0x%02X ", rx_frame.data.u8);
}
printf("\n");
}
}
// // Send CAN Message
// if (currentMillis - previousMillis >= interval) {
// previousMillis = currentMillis;
// CAN_frame_t tx_frame;
// tx_frame.FIR.B.FF = CAN_frame_std;
// tx_frame.MsgID = 0x001;
// tx_frame.FIR.B.DLC = 8;
// tx_frame.data.u8[0] = 0x00;
// tx_frame.data.u8[1] = 0x01;
// tx_frame.data.u8[2] = 0x02;
// tx_frame.data.u8[3] = 0x03;
// tx_frame.data.u8[4] = 0x04;
// tx_frame.data.u8[5] = 0x05;
// tx_frame.data.u8[6] = 0x06;
// tx_frame.data.u8[7] = 0x07;
// ESP32Can.CANWriteFrame(&tx_frame);
// }
}
SAMPLE of the data collected follows: I have manually entered the decoded data beside each message. blank lines I have inserted to show that lines are missing and the data expected. The dump is over 100,000 messages.
7E8 8 23 0 0 0 0 0 0 0
7E8 8 24 0 0 1 6 0 0 0
7E8 8 26 43 6F 70 79 72 69 67 Copyrig
7E8 8 27 68 74 20 32 30 30 37 ht 2007
Daimler
7E8 8 29 20 43 68 72 79 73 6C Chrysl
er LLC.
7E8 8 2B 20 41 6C 6C 20 52 69 All Ri
ghts Re
7E8 8 2D 73 65 72 76 65 64 2E served.
7E8 8 2F 6F 66 74 77 61 72 65 oftware
7E8 8 22 65 6E 74 69 61 6C 20 ential
7E8 8 24 70 72 69 65 74 61 72 prietar
7E8 8 26 72 74 79 20 6F 66 20 rty of
Chrysle
7E8 8 28 72 20 4C 4C 43 2E 20 r LLC.
7E8 8 2A 68 74 20 6E 6F 74 69 ht noti
7E8 8 2C 72 65 63 61 75 74 69 recauti
7E8 8 2E 6E 64 20 64 6F 65 73 nd does
7E8 8 20 70 6C 79 20 70 75 62 ply pub
7E8 8 22 6E 2E 0 0 1C B 21
7E8 8 24 0 0 1C B 21 5 2
7E8 8 26 1C B 22 5 2 0 1C
7E8 8 27 B D8 2 0 0 1C B
7E8 8 29 1 0 0 1C B 14 5
As you can see , several lines are missing.