blackcodetavern / ESP32_FTPClient

An FTP-Client for the ESP32
MIT License
35 stars 8 forks source link

Guru Meditation Error: Core 1 panic'ed (LoadProhibited). #2

Open spyder0069 opened 5 years ago

spyder0069 commented 5 years ago

I am trying to get this working and I get:

Send USER Send PASSWORD Send SYST Send Type A Send PASV Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x40056722 PS : 0x00060830 A0 : 0x8005682e A1 : 0x3ffb1ec0
A2 : 0x3ffb80c0 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x0000000a
A6 : 0x00000000 A7 : 0x00000008 A8 : 0x8000be99 A9 : 0x3ffb1eb0
A10 : 0x3ffb80c0 A11 : 0x00060823 A12 : 0x00060820 A13 : 0x3ffc2a1c
A14 : 0x3ffc2a30 A15 : 0x00000000 SAR : 0x00000019 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff

Backtrace: 0x40056722:0x3ffb1ec0 0x4005682b:0x3ffb1ef0 0x400566cd:0x3ffb1f10 0x400d19a2:0x3ffb1f30 0x400d1a93:0x3ffb1f50 0x400d1b20:0x3ffb1f70 0x400d3b9f:0x3ffb1fb0 0x400885dd:0x3ffb1fd0

The decode shows:

Decoding stack results 0x400d19a2: ESP32_FTPClient::InitFile(char) at C:\Users\user\AppData\Local\Temp\arduino_build_655457\sketch\ESP32_FTPClient.cpp line 142 0x400d1a93: mynewfile() at C:\SPYDERROBOTICSDATA\spyderrobotics\FIRMWARE\arduino\SKETCHBOOK\FTP_TEST\ESP32_FTPClient/ESP32_FTPClient.ino line 44 0x400d1b20: setup() at C:\SPYDERROBOTICSDATA\spyderrobotics\FIRMWARE\arduino\SKETCHBOOK\FTP_TEST\ESP32_FTPClient/ESP32_FTPClient.ino line 32 0x400d3b9f: loopTask(void) at C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.3-rc1\cores\esp32\main.cpp line 14 0x400885dd: vPortTaskWrapper at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/freertos/port.c line 143

Not sure how to proceed? This is a wroom-32d. I can get to the site through a regular ftp program and add/delete files. I appreciate any help i can get!

ldab commented 5 years ago

This is probably due some memory overflow, or infinite loop, can you share your code?

EDIT: check mynewfile() function

spyder0069 commented 5 years ago

Its your sample code but with my credentials. I just removed the makefile from the loop and call it during the setup so it only fires once.

`#include

include

include "ESP32_FTPClient.h"

define ftp_server "XXX"

define ftp_username "XXX"

define ftp_password "XXX"

define wifi_ssid "XXX"

define wifi_password "XXX"

ESP32_FTPClient ftp (ftp_server,ftp_username,ftp_password);

void setup() { Serial.begin(115200); WiFi.begin(wifi_ssid, wifi_password);

Serial.println("Connecting Wifi..."); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.println("Connecting to WiFi..");

} Serial.println("IP address: ");

Serial.println(WiFi.localIP());

ftp.OpenConnection();

mynewfile();

}

void loop() { delay(5000); Serial.println("Looping"); //Create the file new and write a string into it

}

void mynewfile(){ ftp.InitFile("Type A"); ftp.NewFile("hello_world.txt"); ftp.Write("Hello World"); ftp.CloseFile();

ftp.CloseConnection();

//Append an string to a file (it does not need to exist) // ftp.InitFile("Type A"); // ftp.AppendFile("hello_world_append.txt"); // ftp.Write("Hello World"); // ftp.CloseFile(); }`

spyder0069 commented 5 years ago

Its chokes on this line:

array_pasv[i] = atoi(tStr);

This is in the InitFile sub. If I comment it out I don't get the crash and it continues but no file gets created.

ldab commented 5 years ago

Your server is probably returning something different than expected for PASV

Please include a Serial.println(outBuf) at: https://github.com/blackcodetavern/ESP32_FTPClient/blob/b5cd8d4f21e6215d1f073041de90749b5466a455/ESP32_FTPClient.cpp#L137 To check the response, mine one returns 227 Entering Passive Mode (145,14,144,22,198,120).

spyder0069 commented 5 years ago

My response is:

530 You aren't logged in

This is because somehow I mistyped the ftp password. I really appreciate your time. I think I'm leaving that message in there for troubleshooting. :^)

After correcting the password it went through fine. Maybe there should be some error trapping there so that it doesn't crash the processor?

ldab commented 5 years ago

will do, please follow at https://github.com/ldab/ESP32_FTPClient/issues/3

spyder0069 commented 5 years ago

One other thing I noticed is that it doesn't seem to play nice with async webserver. I think if a web page is trying to display at the same time the ftp is happening the server will hang and then eventually you get a crash and reboot. Not exactly sure what a work around would be. Have you tried this at all? I also was looking at the freeheap and it seemed to lower every time it did an upload but didn't return. I need to do some more testing with that to confirm.

ldab commented 5 years ago

Please create another issue here https://github.com/ldab/ESP32_FTPClient

And we can discuss it there, some free webhosting server will have bandwidth limitations, so yes, I have experienced that and it's expected.

spyder0069 commented 5 years ago

I was referring to async webserver for the esp32 to server the webpages. I did some additional testing and it seems to now be working with it. Before I had the ftp running in a ticker and after I just let it run in the main loop everything seems to be working together. I also don't seem to be losing the freeheep so it looks like that is also working.

ldab commented 5 years ago

Fixed, check 2f51996b61645c52c68c36281192d3f56a9f196f

spyder0069 commented 5 years ago

This did fix the crash on a wrong password it then continues on and shows the close file but never returns back to the loop.

spyder0069 commented 5 years ago

Then next command I have is the closeconnection so it might be holding up in there. Let me investigate.

ldab commented 5 years ago

This fixes the issue regarding the original post on this topic. Please create a new issue on the other repository so we can keep track of it.