Hi all,
I have an esp32S2Lolin connecting to a MCP2151 on GPIO16/17/ The can transceiver is running at 125Kbp to talk to an Arduino nano over MCP2515.
I flashed the ESP32 with Esphome however i discovered that: Can bus initialization and sending out of message caused the wifi connection to be failed.
If I swap the can_rx, can_tx:
can_tx_pin: GPIO17
can_rx_pin: GPIO16
The Arduino Nano can receive can message with random number (see image)
but esp32 failed to start wifi connection:
When I swap the can_tx and can_rx, wifi is on successfully but no Can message is received at the Arduino side (of course this is the wrong wiring)
my part of canbus as below:
interval:
- interval: 1000ms
then:
canbus.send:
can_id: 0x305
data: !lambda |-
// ±-------------------------------------+
// | Sending data template to device |
// ±-------------------------------------+
uint8_t can_mesg[8];
int y = 0;
// Device id 1:10
can_mesg[0] = 1 & 0xff;
// Sensor funtion
can_mesg[1] = 1 & 0xff;
// Value for sensor: 1-ON, 2-OFF
can_mesg[2] = id(${name}_built_in_led).state & 0xff;
can_mesg[3] = rand();
can_mesg[4] = rand();
can_mesg[5] = rand();
can_mesg[6] = rand();
can_mesg[7] = rand();// Logs ESP_LOGI("main", "send can id: 0x305 hex: %x %x %x %x %x %x %x %x", can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]); return {can_mesg[0], can_mesg[1], can_mesg[2], can_mesg[3], can_mesg[4], can_mesg[5], can_mesg[6], can_mesg[7]};
Please advise me on how to make the can bus to delay the initialization until WIFI is connected.
Best
Ngoc