Closed TonyBrobston closed 1 year ago
I'm currently trying to flash an esp32. I haven't used platformio before, currently I am running: pio run -e esp32dev
; my understanding is that this will build, upload, clean, etc.
, however I'm getting errors:
Processing esp32dev (platform: espressif32; board: esp32dev; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (4.2.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.20002.0 (2.0.2)
- tool-esptoolpy 1.30300.0 (3.3.0)
- toolchain-xtensa-esp32 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 34 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 2.0.0
|-- <can_common> 0.3.0+sha.07605a2
|-- <ESP32_CAN> 0.2.5+sha.7c3174f
| |-- <can_common> 0.3.0+sha.07605a2
| |-- <SPI> 2.0.0
|-- <PubSubClient> 2.8.0
|-- <WiFi> 2.0.0
|-- <ESPmDNS> 2.0.0
| |-- <WiFi> 2.0.0
|-- <Update> 2.0.0
|-- <WebServer> 2.0.0
| |-- <WiFi> 2.0.0
| |-- <FS> 2.0.0
Building in release mode
Compiling .pio/build/esp32dev/lib6ff/esp32_can/esp32_can.cpp.o
Compiling .pio/build/esp32dev/lib6ff/esp32_can/mcp2517fd.cpp.o
In file included from .pio/libdeps/esp32dev/esp32_can/src/esp32_can.h:2,
from .pio/libdeps/esp32dev/esp32_can/src/esp32_can.cpp:1:
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.h:10: warning: "TX_BUFFER_SIZE" redefined
#define TX_BUFFER_SIZE 32
In file included from .pio/libdeps/esp32dev/esp32_can/src/esp32_can.h:1,
from .pio/libdeps/esp32dev/esp32_can/src/esp32_can.cpp:1:
.pio/libdeps/esp32dev/esp32_can/src/esp32_can_builtin.h:48: note: this is the location of the previous definition
#define TX_BUFFER_SIZE 16
.pio/libdeps/esp32dev/esp32_can/src/esp32_can.cpp:9:61: error: attributes after parenthesized initializer ignored [-fpermissive]
ESP32CAN CAN0(GPIO_NUM_16, GPIO_NUM_17) __attribute__((weak));
^
.pio/libdeps/esp32dev/esp32_can/src/esp32_can.cpp:13:43: error: attributes after parenthesized initializer ignored [-fpermissive]
MCP2517FD CAN1(5, 27) __attribute__((weak));
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'bool MCP2517FD::_init(uint32_t, uint8_t, uint8_t, bool)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:462:45: error: call of overloaded 'abs(uint32_t)' is ambiguous
int errRate = abs(CAN_Bus_Speed - calcRate);
^
In file included from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/cstdlib:75,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdlib.h:36,
from /home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/assert.h:21,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/reent.h:503,
from /home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/reent.h:17,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/stdio.h:60,
from /home/tony/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:27,
from .pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:1:
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/stdlib.h:74:5: note: candidate: 'int abs(int)'
int abs (int);
^~~
In file included from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/cstdlib:77,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdlib.h:36,
from /home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/assert.h:21,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/reent.h:503,
from /home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/reent.h:17,
from /home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/stdio.h:60,
from /home/tony/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:27,
from .pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:1:
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/std_abs.h:78:3: note: candidate: 'constexpr long double std::abs(long double)'
abs(long double __x)
^~~
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/std_abs.h:74:3: note: candidate: 'constexpr float std::abs(float)'
abs(float __x)
^~~
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/std_abs.h:70:3: note: candidate: 'constexpr double std::abs(double)'
abs(double __x)
^~~
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/std_abs.h:61:3: note: candidate: 'long long int std::abs(long long int)'
abs(long long __x) { return __builtin_llabs (__x); }
^~~
/home/tony/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/std_abs.h:56:3: note: candidate: 'long int std::abs(long int)'
abs(long __i) { return __builtin_labs(__i); }
^~~
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual uint32_t MCP2517FD::init(uint32_t)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:715:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual uint32_t MCP2517FD::beginAutoSpeed()':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:720:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual uint32_t MCP2517FD::set_baudrate(uint32_t)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:725:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual uint32_t MCP2517FD::set_baudrateFD(uint32_t, uint32_t)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:730:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual bool MCP2517FD::sendFrame(CAN_FRAME&)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:758:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual bool MCP2517FD::sendFrameFD(CAN_FRAME_FD&)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:763:1: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
In file included from /home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/freertos/semphr.h:34,
from /home/tony/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:35,
from .pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:1:
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'void MCP2517FD::EnqueueRX(CAN_FRAME_FD&)':
/home/tony/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/freertos/include/freertos/queue.h:506:91: warning: passing NULL to non-pointer argument 3 of 'BaseType_t xQueueGenericSend(QueueHandle_t, const void*, TickType_t, BaseType_t)' [-Wconversion-null]
xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:1147:2: note: in expansion of macro 'xQueueSend'
xQueueSend(rxQueue, &newFrame, NULL);
^~~~~~~~~~
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'void MCP2517FD::handleTXFifoISR(int)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:1291:44: warning: passing NULL to non-pointer argument 3 of 'BaseType_t xQueueReceive(QueueHandle_t, void*, TickType_t)' [-Wconversion-null]
if (xQueueReceive(txQueue, &frame, NULL) != pdTRUE) return; //abort if we can't load a frame from the queue!
^
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp: In member function 'virtual int MCP2517FD::_setFilterSpecific(uint8_t, uint32_t, uint32_t, bool)':
.pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:709:9: warning: control reaches end of non-void function [-Wreturn-type]
Write8(ADDR_CiFLTCON + mailbox, 0x80 + 1); //Enable the filter and send it to FIFO1 which is the RX FIFO
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*** [.pio/build/esp32dev/lib6ff/esp32_can/esp32_can.cpp.o] Error 1
*** [.pio/build/esp32dev/lib6ff/esp32_can/mcp2517fd.cpp.o] Error 1
Archiving .pio/build/esp32dev/libFrameworkArduino.a
Indexing .pio/build/esp32dev/libFrameworkArduino.a
======================================================================================= [FAILED] Took 2.52 seconds =======================================================================================
Environment Status Duration
------------- -------- ------------
esp32dev FAILED 00:00:02.518
================================================================================== 1 failed, 0 succeeded in 00:00:02.518 ==================================================================================
Any pointers?
I'll continue to google around and see what I can figure out.
Whelp, could of weird things... my first esp32 D1 Mini is apparently DOA. I tried another and uploaded a simple blink program, the first wouldn't even connect, but the second esp32 D1 Mini worked fine.
After that I was seeing some Permission denied
's, so I threw a sudo
on the front; I'm not sure why this was needed :shrug:.
After that I was getting errors like: pio/libdeps/esp32dev/esp32_can/src/mcp2517fd.cpp:462:45: error: call of overloaded 'abs(uint32_t)' is ambiguous
, which seemed to consistently point to esp32_can
, I eventually realized that the platformio.ini
is pinned to a specific git sha, so as a ditch effort I pulled that off and that seemed to do the trick.
I removed #7c3174f14aed8c025d337cee89f3e4de4e31e36b
from: https://github.com/vekexasia/landcanlogger/blob/ed3434b1f617fac744d7031514bd17c9b48da854/platformio.ini#L21
I expected sudo pio run -e esp32dev
to "build, upload, clean, etc." as pio -h
suggests... but it doesn't seem to upload :man_facepalming:. I'm probably doing something wrong.
This command seems to work: sudo pio run -e esp32dev -t upload
I'm headed out to the garage to hook this up, then I need to install SavvyCAN and see if I can get some CAN Data flowing.
I am currently stuck and not entirely sure what is happening (I think it's in a boot loop... :thinking:), here are the logs:
Connecting to NovemberOscarTangoHotel
........
WiFi Connected. IP:
192.168.5.55
Attempting MQTT connection...Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4008e7af PS : 0x00060633 A0 : 0x8008d591 A1 : 0x3ffb24a0
A2 : 0x00b83fdc A3 : 0x3ffc488c A4 : 0x00000004 A5 : 0x00060623
A6 : 0x00060623 A7 : 0x00000001 A8 : 0x00000001 A9 : 0x00000001
A10 : 0x3ffcff54 A11 : 0x3ffd024c A12 : 0x3ffcff00 A13 : 0x00000003
A14 : 0x007bf168 A15 : 0x003fffff SAR : 0x0000000f EXCCAUSE: 0x0000001c
EXCVADDR: 0x00b83fe0 LBEG : 0x400ef539 LEND : 0x400ef546 LCOUNT : 0x00000000
Backtrace:0x4008e7ac:0x3ffb24a00x4008d58e:0x3ffb24c0 0x4008c8b8:0x3ffb24e0 0x400fec6a:0x3ffb2520 0x400fef99:0x3ffb2540 0x400edbce:0x3ffb2560 0x400ef560:0x3ffb2590 0x400e8dbd:0x3ffb2630 0x400d65ee:0x3ffb
ELF file SHA256: 0000000000000000
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
......
WiFi Connected. IP:
192.168.5.55
Attempting MQTT connection...
assert failed: xTaskRemoveFromEventList tasks.c:3657 (pxUnblockedTCB)
Backtrace:0x40083835:0x3ffb23500x4008b7e9:0x3ffb2370 0x40090ca9:0x3ffb2390 0x4008d586:0x3ffb24c0 0x4008c8b8:0x3ffb24e0 0x400fec6a:0x3ffb2520 0x400fef99:0x3ffb2540 0x400edbce:0x3ffb2560 0x400ef560:0x3ffb
I also found that if I use 8d4a004016e84d636c27cb25b7019e7fc7edf1f8
rather than 7c3174f14aed8c025d337cee89f3e4de4e31e36b
for esp32_can
, it compiles fine. This sha is 3 or 4 commits newer.
Here is some more from the logs on a different ESP32 D1 Mini:
Connecting to NovemberOscarTangoHotel
Brownout detector was triggered
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
............
WiFi Connected. IP:
192.168.5.56
Attempting MQTT connection...Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4008e7b5 PS : 0x00060633 A0 : 0x8008d591 A1 : 0x3ffb24a0
A2 : 0x2c026c24 A3 : 0x3ffc488c A4 : 0x00000004 A5 : 0x00060623
A6 : 0x00060623 A7 : 0x00000001 A8 : 0x026c082c A9 : 0x026c082c
A10 : 0x026c082c A11 : 0x3ffcebf0 A12 : 0x3ffd1584 A13 : 0x00000003
A14 : 0x007bf168 A15 : 0x003fffff SAR : 0x0000000f EXCCAUSE: 0x0000001d
EXCVADDR: 0x026c0834 LBEG : 0x400ef539 LEND : 0x400ef546 LCOUNT : 0x00000000
Backtrace:0x4008e7b2:0x3ffb24a00x4008d58e:0x3ffb24c0 0x4008c8b8:0x3ffb24e0 0x400fec6a:0x3ffb2520 0x400fef99:0x3ffb2540 0x400edbce:0x3ffb2560 0x400ef560:0x3ffb2590 0x400e8dbd:0x3ffb2630 0x400d65ee:0x3ffb
ELF file SHA256: 0000000000000000
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
Brownout detector was triggered
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
......
WiFi Connected. IP:
192.168.5.56
Attempting MQTT connection...ets Jun 8 2016 00:22:57
rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
Brownout detector was triggered
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1184
load:0x40078000,len:12776
load:0x40080400,len:3032
entry 0x400805e4
Connecting to NovemberOscarTangoHotel
..........
WiFi Connected. IP:
192.168.5.56
Attempting MQTT connection...
I commented out the ota code and I'm now able to get the code to run without constantly rebooting or having whatever the brownout detector thing is.
I think it would also be useful to add some logic to do mqtt availability; so essentially a topic published on start-up and shutdown. I temporarily added something so I could verify that wifi connected and an mqtt message could publish, since I can't view serial with the mower in the yard running. Well I guess I could chase it with a laptop, but I can't give my neighbors that kind of entertainment for free :rofl: .
I must have something wrong on the CAN side of things. I'm not seeing anything CAN related from the Landroid... :confused: I currently have it hooked up where the "find my landroid" is supposed to go.
I think I either:
I also just remembered that I have this on a WiFi network that has internet traffic blocked, which might be why the OTA code is causing issues.
I'm still pondering why I'm not seeing CAN data. I'll probably put a post in discord and see if anyone has any ideas. I feel like I'm getting really close.
Hey @TonyBrobston you could try inverting the pin in esp32. I might have made a mistake in README?. Also make sure esp32 is connected to wifi and the mqtt.
Brownout -> not enough amps provided by the psu.
Joining discord is always a good idea for real-time troubleshooting anyway.
@vekexasia Thanks for the response.
I'll hopefully get back to this soon and I'll use the discord channel when I do.
I did try flipping the CAN pins, but had no luck. I'll do some testing, maybe I have a faulty jumper wire or something simple.
I did confirm WiFi/MQTT we're working with a status topic I added to publish on startup.
Thanks for the work you've done on this project, I'll have something to contribute at some point, as I'm definitely interested in being able to play/pause over MQTT.
Hello @TonyBrobston can you check issue #1 ? I posted some pics of my working setup. Also I updated the readme as I inverted RX and TX pins in ESP32 in the original readme.
@vekexasia I will when I have some time.
Thanks for the pictures and the readme update! I imagine that will get me the rest of the way to working.
Hello,
I just stumbled upon this repo yesterday, I think reddit suggested a post to me or something along those lines.
I have had interest for awhile now in at a minimum being able to start, stop, resume, pause my Landroid via MQTT. I would love other functionality, however this seems like a good and simple place to get my feet wet.
My background is in software development; I'm not sure I can commit to coding, but I think I can commit to helping one way or another.
Ideally my initial goal would be to create something that can do what I mentioned above, with the intent to create an automation in Home Assistant to tie two systems together. Scenarios look like:
The biggest unknown for me is how to use an ESP32 or ESP8266 to do this. I have enough experience that I believe I can work out everything except how to send the message over canbus; I would need some pointers or some time to research (or both). I'm familiar with this library: https://github.com/Hypfer/esp8266-midea-dehumidifier which might be a good example.
I assume the general process is: hook up ESP32 and Waveshare SN65HVD230, get the canbus logging software recording, do some action either through the Landroid app... or through clicking a button on the Landroid... or observe some action the Landroid does (like getting stuck), then somehow use this captured output (aka read) to then write this captured output back to the Landroid when we want to perform whatever action was performed?
I don't have any accessories; would it still be worth it to buy an ESP32 and Waveshare SN65HVD230 and install them? I'm really tempted to, as that seems like a good starting point.
I was wondering, would an ESP8266 work in place of the ESP32? I have a bunch of ESP8266's that I've been playing around with. Based on what I googled, it seems like the ESP8266 is a single core and ESP32 is dual core? Maybe there's more to it?
Is
CNH
andCNL
on the Landroid board refer toCAN_H
andCAN_L
? This can be seen in this picture, the top middle white plug: https://user-images.githubusercontent.com/4724577/162841949-265952e3-6768-4773-99a1-d5f3cce8002b.jpg Is this similar to how you made your connections? If so, I'll connect the hardware, take some pictures, and update the readme?Sorry for the long read, I have had a lot on my mind. Thanks for any help you can provide and great work so far!