stuartpittaway / diyBMSv4ESP32

diyBMS v4 code for the ESP32 and new controller hardware
Other
179 stars 80 forks source link

stack overflow in task sdlog #191

Closed moscito1010 closed 10 months ago

moscito1010 commented 1 year ago

Describe the bug A clear and concise description of what the bug is.

Controller from the Patreon Deal Version: 2023-03-17 Precomp Image

Is it possible that the SD card is not recognized in the current controller firmware? There are also problems with communication when I want to use the "storage & logging" option

image

If I use the firmware from 2023-03-01 there is no error and the SD card is recognized and used.

moscito1010 commented 1 year ago

Addition: If I refresh the browser a few times, the error is gone and the map is used. I'll try different browsers

moscito1010 commented 1 year ago

I've tried a few things now.

No display, different browsers, a different power supply with 16 and 32 modules and a different controller with a different ESP32. The error is always the same as soon as I select "storage & logging". As you can see in the picture at the runtime, the controller then restarts completely. The SD card is not always mounted and as soon as I activate logging the controller hangs almost every 30 seconds. image

And finally I found the error. :-)

If I take the memory card out of the controller, the spit is over. I tested several memory cards. All were provided with a 2GB partition because they actually have 32 or 64, 128, 256 gb, I don't have any smaller SD cards.. I have not found an SD card with which my controller runs correctly. Is it possible that the controller only accepts "real" 2GB SD cards without stumbling. My cards are all UHD3 Class 10 (40mb/s or faster) from Toshiba

stuartpittaway commented 1 year ago

Hi, thanks for the detailed logs.

ESP32 should support up to 4GB of capacity - anything larger than that should still work, it just won't be "seen".

Have you tried simply re-formatting the card again (FAT32 format) ?

The SD card library/code in the controller gets updated automatically with the "core" of the ESP32/Arduino so I don't specifically change anything - although this does look like a potential bug.

Do you have the ability to log the "serial usb" output from the ESP32 (connect a USB cable and record/log the output) - on boot up it should report any errors on the SD card it finds.

moscito1010 commented 1 year ago

Yes I can do that tonight. I have a Raspberry 400 there that can record for 20 minutes.

stuartpittaway commented 1 year ago

Should only take a minute or two - reboot the controller and see what it spits out!

moscito1010 commented 1 year ago

I just can't get around to it, I'll try on Sunday.

moscito1010 commented 1 year ago

well, but now.... Today I had some time and let the Raspi write it down. putty1.log is without SD card putty2.log is with inserted SD card

The following fact is striking. I supply the EPS32 controller with 5v from a switching power supply via the terminal block and not via USB. To log I have to plug a USB cable into the USB port of the ESP32. As soon as I operate the controller without an SD card AND use an additional power source (the USB cable), does the controller run more stably?!? With the SD card inserted, the controller is unusable and keeps restarting or freezing. putty1.log putty2.log

I still have O.O.S and CRC errors. I have the impression that there are fewer with additional USB cables.

Shunt voltage is also not displayed. The shunt flashes regularly with the blue LED, a connection to the shunt is being established as it appears. image

stuartpittaway commented 1 year ago

In the first log, there is a message Found TCA6416A, which is correct.

However, in the second log, you have hundreds of errors in the log files like this....

HAL_ESP32::WriteTCA9534APWROutputState()

This indicates the 6416A chip was not found when the SD card was inserted.

Can you upload a photo of the controller, particularly the version number.

moscito1010 commented 1 year ago

This is the controller from the Patreon campaign. You sent it to me in the mail. Purple PCB

stuartpittaway commented 1 year ago

Ok, is this the one with the extra wire soldered onto the reverse?

moscito1010 commented 1 year ago

nein

stuartpittaway commented 1 year ago

Reviewing the second log file, the message ***ERROR*** A stack overflow in task sdlog has been detected. has been reported.

stuartpittaway commented 1 year ago

The sdlog overflow error should have already been fixed by commit 21d4879ab7d5aae70540305a8ea67d19289c856e

This is part of the next release.

stuartpittaway commented 1 year ago

The release was pushed up last week - can you test and report back please?

moscito1010 commented 1 year ago

Of course I can do that. But that's only on Wednesday evening. I'm still in the UK (Derby) and am going back to northern Germany (near Lüneburg) on Tuesday at noon. As soon as I'm home I'll take care of the BMS

moscito1010 commented 1 year ago

Sorry my response is so slow but I have so much work to do. Today I had a few minutes and brought one of the two battery storage systems to my workshop. I flashed the new firmware to the ESP32 and screwed the battery pack back on with 16x 1.9f modules The controller still crashes as soon as I tap the screen, that's all I can tell. The number of O.O.S errors has dropped to ZERO. But there are only 16 and not 32 modules.

Tonight I will prepare Zen Buddhist 16 pieces 4.21 modules to use in the test. Just to confirm the 1.9f modules as a possible bug. That's only possible with a direct comparison.

stuartpittaway commented 1 year ago

If you don't need it, can I suggest removing the TFT display? I've got 3 running at home and none of those crash on touch, could be a faulty esp32, a soldering issue or a faulty TFT

stuartpittaway commented 1 year ago

How's the system operating @moscito1010 ?

moscito1010 commented 1 year ago

Not Stuart at the moment. I am using a Battrium BMS until I get the 4.50 modules from JLCPCB. I destroyed or gave away all the 1.9f modules and I didn't have enough of the other modules. The 4.50 modules will arrive next week. Unfortunately no attinys were available, I got them from another source. When I have the boards I bring the ICś and the boards to a service provider and have the attiny's soldered on. They're too small for me, I can't solder them without a camera and magnification. I will probably have to buy helpful technology if I want to solder it myself in the future :-)

stuartpittaway commented 10 months ago

I'm closing this issue for now as I think the SD card logging function is working fine in the latest release. Please raise a new issue if this is incorrect.