Working with example 2.1 with one button in “Build Web servers…” – I am working on my own designed hardware, so platformIO.ini does not follow the book example. I can upload and debug – it seems to work.
I can establish WiFi station – get the IP-adr – and I can ping it from a browser on my PC. I can see the path in VS and if I change the name in VS – it changes on the file path finder. So I think the project is setup correct. When I double click the index.html file in the file-manager it shows up – nicely formatted with the CCS.
Then I upload and try to display in a browser window. As far as I know when I enter the IP-adress it searches for index.html?? However no page shows up. I have a feeling that the page perhaps is not uploaded to the ESP32.
How can I verify this ? Any help greatly appreciated – I hate when I get stuck without any clue what to do…. 🙁
I forgot to mention that “Hello World” displays as a charm – it works perfectly…
After a closer study I found this difference:
Hello World saves in flash memory with command:
const char index_html[] PROGMEM = R”rawliteral(
<!DOCTYPE html><html>…..</html>
)rawliteral”;
And the other project via this: �SPIFFS mounted successfully
I try to dig into this…
Hi.
You need to upload the files to the ESP32 filesystem. Otherwise, it won’t work.
Do you know how to do that using VS Code? It is explained in the ebook.
However, we’ve created this in-depth tutorial that might help: https://randomnerdtutorials.com/esp32-vs-code-platformio-spiffs/
Regards,
Sara
Thanks Sara. So kind of you. I will study the link and work on it.
However I have found something: I have used wrong pin’s for LED’s. Pin are not recommended for this, so I will make new hardware. This problem is not of general interest – I would suggest this issue be deleted. If problem still persist when I have new hardware I will make a new entry. Or at least this could be marked as solved.
Sorry for this folks… 🙁
PIns 19 + 20 + 21 +22. I am using ESP32M4…
Having a look into the link: HOW NICE !!!! there is a routine to display the Flash memory contents… I love you two folks….
Yes. I think it is a good idea to change the pins for the LEDs.
Just for reference, here’s the datasheet of that board: https://eu.mouser.com/datasheet/2/915/Fanstel_11192020_ESP32-1923890.pdf
Regards,
Sara
OK – I have just removed the driver resistor om these pins, which have now left them open. That would work ?
I am trying your SPIFFS testing-tool from your link, but have run into some problems. I had to insert a delay to get the terminal to respond, but I never get as far as the statement “starting serial”:
void setup() {
Serial.begin(9600);
delay (3000); (2000 was not enough for me)
Serial.println(“starting serial”);
if(SPIFFS.begin(true)){
Serial.println(“mounting SPIFFS”); (mount OK. So far so good)
return;
}
delay (5000);
Serial.println(“Why do I Never get here???”);
File file = SPIFFS.open(“/text.txt”);
if(!file)
{
Serial.println(“Failed to open file for reading”);
return;
}
Do I need to format the flash – maybee the first time?
Now this is NewYears Eve so I am propably indisposed a day or two… ;.)
Steen
Hi.
What do you mean by “you need to insert a delay for the terminal to respond”? What happens exactly?
Regards,
Sara
This line : Serial.println(“starting serial”); is supposed to print on the terminal. However without the delay nothing shows up.
In the meantime I have learned about some code which can write the files into the flash and readout again.
I have written manually these files in flash: /index.html + /style.css + /script.js + /favicon.jpg, and I can display them in the flash.
I can single step to this statement:
server.on(“/”, HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, “/index.html”, “text/html”, false, processor);
});
However I have no idea how to verify if it works. I’m not familiar with call stack etc…
I can ping the local IP-adr: 192.168.0.38 – but I still do not get any index.html. Still no WEB-page in the browser.
I have a Wrover kit and have copied the code to it (proper platformIO.ini). Could I miss a pointer ??? I have both used the original code from the book, and one with my modifications to the Wrover kit:
– still no index.
I am in deep shit here – this has nothing to do with your code. Now not even the “Hello…” runs.
Finally I got errors messages about “denied access to the USB port” – This was not true.
I hate Espressif for using a dual port on USB – it’s a pain in the ass.
Then I got a message: No source file named e:\ESP\ESP32_Projects\ESP32 Hello World\src\main.cpp. (from break-insert “e:\\ESP\\ESP32_Projects\\ESP32 Hello World\\src\\main.cpp:47”)
Not true – it’s there”
I am reinstalling the ESP libraries. I will keep you posted.
Ok.
If you can’t access the web page when you go to the ESP IP address, it probably means that the file is not saved on the filesystem.
Regards,
Sara
Hi Sara – so nice you keep hanging.
I have a hardware problem with my USB-port. I can manage that now – every time I get a Python message something like “denied access to the USB port” – I just reconnect the USB – and sometimes run Zadig. I have learned how to format the flash and can write the files (/index.html, /style,/script.js,favicon.png/) manually into flash and display them from the flash.
So I am sure the index.html is in flash. I can ping – but nothing show up in the browser – not even an error message. I would expect “404 page not found” ???
This is run on the Wrover-kit – not my home made board.
Hi.
What do you mean you wrote the files manually?
Upload the files as explained in the eBook, and then see if you got it working.
Regards,
Sara
I followed your book in the first place – but on my own hardware.
I’ll do it again and this time on the Wrover kit.
Same result – no index.html
I have run this little routine:
void listAllFiles(){
File root = SPIFFS.open(“/”);
File file = root.openNextFile();
while(file){
Serial.print(“FILE: “);
Serial.println(file.name());
file = root.openNextFile();
}
}
And the result is:
FILE: /index.html
FILE: /style.css
FILE: /script.js
FILE: /favicon.png
OK – I started all over with 2_5_Multiple_Outputs_Websocket.
I formatted the flash so I had a clean start.
I modified SSID and password + Serial begin(9600). I can ping
But there is no index.html (or style.css etc…) in flash.
Is it the command below… that transfers index.html to flash?
// Route for root / web page
server.on(“/”, HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, “/index.html”, “text/html”,false);
});
�R~�fgRSPIFFS mounted successfully
Connecting to WiFi …..192.168.0.36
Pinging 192.168.0.36 with 32 bytes of data:
Reply from 192.168.0.36: bytes=32 time=111ms TTL=255
Reply from 192.168.0.36: bytes=32 time=120ms TTL=255
Reply from 192.168.0.36: bytes=32 time=234ms TTL=255
Reply from 192.168.0.36: bytes=32 time=43ms TTL=255
OK – new info
Now I have installed VS-code (and platformIO…etc) on a different labtop. I copied my eBook to this machine, and downloaded from the link on page 342 and opened the project. Inserted SSI+password. Ran the project completely without any problems.
I can ping and this time I get the answer: HTTP 404 – page not found. The index.html… was not uploaded in flash.
I guess your code is working OK. At this moment I am working to find out where the pointer to index.html is in flash memory – which have brought me to the esptool. I will keep you posted if I find the solution. Any help on this?
Hi.
What do you see in the debugging window when you upload the files to the filesystem?
Regards,
Sara
Reading symbols from e:\ESP\ESP32_Projects\2_5_Multiple_Outputs_Websocket\.pio\build\esp-wrover-kit\firmware.elf…
done.
PlatformIO Unified Debugger -> https://bit.ly/pio-debug
PlatformIO: debug_tool = ftdi
PlatformIO: Initializing remote target…
Open On-Chip Debugger v0.10.0-esp32-20210721 (2021-07-21-13:35)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
adapter speed: 2000 kHz
Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway…
Error: esp32.cpu0: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : accepting ‘gdb’ connection from pipe
Warn : No symbols for FreeRTOS!
Error: Target not examined yet
Error executing event gdb-attach on target esp32.cpu0:
Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use ‘gdb_memory_map disable’.
Error: attempted ‘gdb’ connection rejected
Error: error during select: Unknown error
.pioinit:11: Error in sourced command file:
Remote communication error. Target disconnected.: No error.
**************
And this one: Failed to launch GDB: .poiinit11: Error in sourced command file:
Remote communiation error. Target disconnected.:No error. (from interpreter-exec console “source pioinit”)
OK – debug seems to have a problem ???
This next debug is from the “Hello World” using R”literal( memory )rawliteral”;
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
PlatformIO: Initialization completed
The files (index.html….) does not upload to ESP in the SPIFF system. Could the reason be that my project is placed in E:\ESP\ESP32projects ???
This would make sense – even if I can write index.html manually in flash – the pointer maybee has to be from within the filesystem – as done via the code..?
New information: I cannot read a SPIFFS file. I have opened a issued in the platformIO forum on this subject. I will return here when solved.
Well – you only pile up experience end learn from your mistakes. In this case not much to learn for others. I reinstalled VS-code,Python,platformIO – and what really helped (I think) was to start from scratch with your project 1.1. Hello WEB-server. Some configuration got lost on the way. I managed to destroy one Wrover and one ESP32M4 board. Don’t ask me what happened. I have now build a new ESP32M4 board and am up running 2_5_Multiple with WEBsocket. Beautifull – the world is much better now, the sun is shining. I started on this this problem before Xmas, so it is a relief to get on… Thank you Sara and Rui for your wonderfull book and support…