Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDCard file manager does not show size of SDCard #21830

Closed
10 of 13 tasks
hagenbuch opened this issue Jul 23, 2024 · 23 comments
Closed
10 of 13 tasks

SDCard file manager does not show size of SDCard #21830

hagenbuch opened this issue Jul 23, 2024 · 23 comments
Labels
Arduino Core Type - Issue / feature is related to Arduino Core wont/can't fix Result - Requested that can't be fixed/added or it is outside scope

Comments

@hagenbuch
Copy link

hagenbuch commented Jul 23, 2024

PROBLEM DESCRIPTION

On Tasmocompiler, I've compiled (german language) Tasmota32 for my Olimex ESP32-POE (chip is ESP32-D0WDQ6 v1.0), Ethernet works and it is able to use my SDCard, can read Bosch sensors (compiled it that way). So far so good.

It does also display files on the SDcard and in the filemanager, I am able to switch between both filesystems. When browsing built-in flash, the size is shown correctly (304 kByte) but when the contents of the SDCard is supposed to be shown, it reads only "Größe 0,000 MB - Frei 0,000 MB [SDCard]"
I hope I can attach a screenshot.

REQUESTED INFORMATION

Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!

  • Read the Contributing Guide and Policy and the Code of Conduct
  • Searched the problem in issues
  • Searched the problem in discussions
  • Searched the problem in the docs
  • [] Searched the problem in the chat
  • Device used (e.g., Sonoff Basic): Olimex ESP32-POE, older revision
  • Tasmota binary firmware version number used: 14.1
    • Pre-compiled
    • Self-compiled
  • Flashing tools used: OTA
  • Provide the output of command: Backlog Template; Module; GPIO 255:
  Configuration output here:

19:13:07.635 RSL: RESULT = {"NAME":"Olimex ESP32-PoE","GPIO":[1,1,8864,1,0,1,0,0,5536,1,8832,8800,1,0,5600,1,1,1,1,5568,1,1,1,1,0,0,0,0,1,1,32,1,1,1,1,1],"FLAG":0,"BASE":1}
19:13:07.855 RSL: RESULT = {"Module":{"0":"Olimex ESP32-PoE"}}
19:13:08.064 RSL: RESULT = {"GPIO0":{"0":"None"},"GPIO1":{"0":"None"},"GPIO2":{"8864":"SDIO D0"},"GPIO3":{"0":"None"},"GPIO4":{"0":"None"},"GPIO5":{"0":"None"},"GPIO6":{"0":"None"},"GPIO7":{"0":"None"},"GPIO8":{"0":"None"},"GPIO9":{"0":"None"},"GPIO10":{"0":"None"},"GPIO11":{"0":"None"},"GPIO12":{"5536":"ETH POWER"},"GPIO13":{"640":"I2C SDA1"},"GPIO14":{"8832":"SDIO CLK"},"GPIO15":{"8800":"SDIO CMD"},"GPIO16":{"608":"I2C SCL1"},"GPIO17":{"0":"None"},"GPIO18":{"5600":"ETH MDIO"},"GPIO19":{"0":"None"},"GPIO20":{"0":"None"},"GPIO21":{"0":"None"},"GPIO22":{"0":"None"},"GPIO23":{"5568":"ETH MDC"},"GPIO24":{"0":"None"},"GPIO25":{"0":"None"},"GPIO26":{"0":"None"},"GPIO27":{"0":"None"},"GPIO32":{"0":"None"},"GPIO33":{"0":"None"},"GPIO34":{"32":"Button1"},"GPIO35":{"0":"None"},"GPIO36":{"0":"None"},"GPIO37":{"0":"None"},"GPIO38":{"0":"None"},"GPIO39":{"0":"None"}}
  • If using rules, provide the output of this command: Backlog Rule1; Rule2; Rule3:
  Rules output here:

  • Provide the output of this command: Status 0:
STATUS 0 output here:

19:13:58.078 RSL: STATUS = {"Status":{"Module":0,"DeviceName":"oli-7","FriendlyName":["oli-7"],"Topic":"tasmota_9EFC04","ButtonTopic":"0","Power":"0","PowerLock":"0","PowerOnState":3,"LedState":1,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0,"InfoRetain":0,"StateRetain":0,"StatusRetain":0}}
19:13:58.084 RSL: STATUS1 = {"StatusPRM":{"Baudrate":115200,"SerialConfig":"8N1","GroupTopic":"tasmotas","OtaUrl":"","RestartReason":"Software reset CPU","Uptime":"0T00:16:23","StartupUTC":"2024-07-23T17:57:35","Sleep":50,"CfgHolder":4617,"BootCount":22,"BCResetTime":"2023-10-07T21:09:09","SaveCount":47}}
19:13:58.088 RSL: STATUS2 = {"StatusFWR":{"Version":"14.1.0(TasmoCompiler-esp32generic)","BuildDateTime":"2024.07.23 17:51:05","Core":"3_0_0","SDK":"5.1.4.240529","CpuFrequency":160,"Hardware":"ESP32-D0WDQ6 v1.0","CR":"331/699"}}
19:13:58.093 RSL: STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"MqttLog":0,"SysLog":0,"LogHost":"","LogPort":514,"SSId":["dellekom",""],"TelePeriod":300,"Resolution":"558180C0","SetOption":["00008009","2805C80001000600003C5A0A192800000000","00000080","00006000","00004000","00000000"]}}
19:13:58.109 RSL: STATUS4 = {"StatusMEM":{"ProgramSize":1481,"Free":1398,"Heap":103,"StackLowMark":3,"PsrMax":0,"PsrFree":0,"ProgramFlashSize":4096,"FlashSize":4096,"FlashChipId":"1640C8","FlashFrequency":40,"FlashMode":"DIO","Features":["0407","0700D5CE","000C0001","61F60FC3","1A4C0004","D0360888","40092098","00200000","5400E0C8","01008080","00000004"],"Drivers":"1,2,!4,9,10,26,29,!35,38,50,52,62,!63,!68,82,!121","Sensors":"1,2,5,6,7,8,9,14,15,17,18,19,20,21,26,27,31,38,39,42,44,46,47,53,55,56,58,59,63,65,66,72,73,74,88,89,91,92,93,103,109,127","I2CDriver":"8,9,10,15,17,18,20,21,24,29,30,32,36,41,42,43,45,46,51,52,60,61,62,63,76,82"}}
19:13:58.117 RSL: STATUS5 = {"StatusNET":{"Hostname":"oli-7","IPAddress":"192.168.13.128","Gateway":"192.168.13.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.13.1","DNSServer2":"2003:a:1417:xxx","Mac":"24:0A:C4:xxx","IP6Global":"2003:a:1417:xxx","IP6Local":"fe80::260a:c4ff:fe9e:fc04%st2","Ethernet":{"Hostname":"oli-7-eth","IPAddress":"192.168.13.98","Gateway":"192.168.13.1","Subnetmask":"255.255.255.0","DNSServer1":"192.168.13.1","DNSServer2":"2003:a:1417:xxx","Mac":"24:0A:C4:9E:FC:07","IP6Global":"2003:a:1417:xxx","IP6Local":"fe80::260a:c4ff:fe9e:fc07%en1"},"Webserver":2,"HTTP_API":1,"WifiConfig":4,"WifiPower":16.0}}
19:13:58.121 RSL: STATUS6 = {"StatusMQT":{"MqttHost":"","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_9EFC04","MqttUser":"DVES_USER","MqttCount":0,"MAX_PACKET_SIZE":1200,"KEEPALIVE":30,"SOCKET_TIMEOUT":4}}
19:13:58.126 RSL: STATUS7 = {"StatusTIM":{"UTC":"2024-07-23T18:13:58Z","Local":"2024-07-23T19:13:58","StartDST":"2024-03-31T02:00:00","EndDST":"2024-10-27T03:00:00","Timezone":"+01:00","Sunrise":"05:12","Sunset":"20:40"}}
19:13:58.131 RSL: STATUS10 = {"StatusSNS":{"Time":"2024-07-23T19:13:58","BME280-76":{"Temperature":25.1,"Humidity":50.8,"DewPoint":14.2,"Pressure":989.4},"BME680-77":{"Temperature":26.4,"Humidity":58.8,"DewPoint":17.7,"Pressure":989.1,"Gas":69.83},"PressureUnit":"hPa","TempUnit":"C"}}
19:13:58.139 RSL: STATUS11 = {"StatusSTS":{"Time":"2024-07-23T19:13:58","Uptime":"0T00:16:23","UptimeSec":983,"Heap":104,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"Berry":{"HeapUsed":3,"Objects":34},"Wifi":{"AP":1,"SSId":"xxx","BSSId":"74:42:7F:xxx","Channel":11,"Mode":"HT20","RSSI":60,"Signal":-70,"LinkCount":1,"Downtime":"0T00:00:04"}}}
  • Set weblog to 4 and then, when you experience your issue, provide the output of the Console log:
  Console output here:

TO REPRODUCE

EXPECTED BEHAVIOUR

Should state something like 4.00 GByte

SCREENSHOTS

tasmota32-14 1-sdcard-no-size

(Please, remember to close the issue when the problem has been addressed)

@sfromis
Copy link
Contributor

sfromis commented Jul 23, 2024

With a 2 GB SD card, I'm seeing: Size 1979.600 MB - Free 1979.592 MB
What file system is your card formatted with? Should be FAT32.

@hagenbuch
Copy link
Author

hagenbuch commented Jul 24, 2024

Thanks for answering so quickly!

Yes, the card is FAT32 formatted but it is 8 GByte, this might be a problem. However, I can still put stuff on it while on my desktop machine (Linux Mint) and am able to download a file even from a folder but I can not upload anything via the Tasmota file manager while in SDCard mode, I am able to upload (small enough) files to the built in flash.

Just in order to test, I reformatted the SDHC with Linux's disk manager but apparently it is not possible to "shrink" the "volume" or partition only a part of the card.

As it is hard already to buy SDCards that are that "small", I hope there will be a solution somehow.

Another really minor thing (that I have to say only as I am an UI developer and Tasmota is already great so I hope to improve):

In File manager, the switching to internal flash (and back to SDCard) works by clicking on "SDCard" because it contains a link. However, we have to click the link "SDCard" to get away from the SDCard. This might be a little confusing for beginners. Maybe just show where we are as text wothout link and then add a "toggle" button?

@Jason2866
Copy link
Collaborator

The issue you encounter is not caused by Tasmota. Tasmota uses the provided functions from Arduino for accessing SD Card. The issue should be opened at espressif32 github.
For Feature Requests please open a new thread in discussions

@Jason2866 Jason2866 added Arduino Core Type - Issue / feature is related to Arduino Core wont/can't fix Result - Requested that can't be fixed/added or it is outside scope labels Jul 24, 2024
@hagenbuch
Copy link
Author

Thank you but sorry to come back, do you mean this repo?

https://github.com/tasmota/platform-espressif32

I could not find Espressif's github aparently.. glad for any help!

@Jason2866
Copy link
Collaborator

Jason2866 commented Jul 24, 2024

No espressif Arduino repo. This one https://github.com/espressif/arduino-esp32
Platformio (platform-espressif32) is just the IDE providing the Arduino core

@sfromis
Copy link
Contributor

sfromis commented Jul 24, 2024

Over 32 GB would be where I'd "expect" trouble with FAT32, not smaller than that. I have a vague recollection of some brands working better than others, but do not remember details.

Here's what I got after formatting an 8 GB FAT32 partition on a 128 GB SD cart using Gnome Disks under Linux:
Size 7797.872 MB - Free 7797.864 MB
(Obviously, there's the usual thing about what one GB really means as a number)

One risk zone may be if your setup can't deliver good power to the SD card.

@Jason2866
Copy link
Collaborator

I have 16Gbyte SD Cards from Sandisk which work perfectly fine with PC and mobile Phone.
Not working with Arduino. Not only the size matters, others stuff idk too.
Have 32Gbyte SD Cards working perfectly fine with Arduino and useable 32Gbyte

@hagenbuch
Copy link
Author

@Jason2866 that means 16 and 32 GByte SDCards do not only show up in Tasmota's file manager but are writeable as well? Also thanks for the right repo!

@sfromis many thanks I'll examine both of your hints!

I am connected to a USB power supply that is able to serve about 65 W in total.. but I will add a beefy electrolytic capacitor just to test / and test with PoE, maybe that changes the outcome.

@sfromis
Copy link
Contributor

sfromis commented Jul 24, 2024

The power situation is not "just" about your power supply or an added decoupling capacitor, but also how much is available at 3.3V, from the voltage regulator. Basically about the total power budget at that potential, and a SD card (with the MCU running) might even need 100 mA, but power consumption can vary a lot across different cards.

@Jason2866
Copy link
Collaborator

Jason2866 commented Jul 24, 2024

I don't believe power supply is the reason for showing "0".
Yes, when lucky a SD Card with 32Gbyte can be used. Read/Write files and correct sizes are shown. It "just" depends on the inner structure of the SD Card.

@Jason2866
Copy link
Collaborator

Jason2866 commented Jul 24, 2024

Maybe updating the Arduino core to the newer maintained libs from https://github.com/greiman/SdFat/tree/master solves the issues?

Interesting post from greiman about which tool should be used for formatting
greiman/SdFat#406 (comment)

@hagenbuch
Copy link
Author

Thanks to all of you: I tested various SDCards: 8, 16 GB from Intenso, one 32 GB from Sandisk, all show the same (0,000 MB), even if I use PoE, no other current consumption. I'm also using Tasmota on a "Cheap Yellow Display" but could not make the SDCard run there, despite swapping software serial around. What confuses my a little is that on the Olimex, I am using I2C (SCL, SDA) to access the SDCard, the Cheap Yellow Display seems to connect the SDCard with SPI: SCLK 18, MISO 19, MOSI 23, CS 5. May I need to ise I2C but then what is SDA, what is SCL?

@Jason2866
Copy link
Collaborator

SD Cards are connected via SPI. There is a nice wiring diagram here https://github.com/espressif/arduino-esp32/tree/master/libraries/SD

@hagenbuch
Copy link
Author

Thanks but this is how Olimex wires the SDCard (in my revision at least) and I am able to read stuff..
20240724 Olimex-POE SDCARD Pinout

@sfromis
Copy link
Contributor

sfromis commented Jul 24, 2024

I'd not expect I2C to be relevant to using a SD card from Tasmota. What is that "I am using" based on? Did you configure I2C pins for the SD card? Silk screen labeling on the board tells nothing, as ESP32 allow basically any pin anywhere (except for analog and Ethernet). Also, it is not too uncommon that SPI pins are labeled SDA/SCL for MOSI/CLK.

Inserting the 128/8 card mentioned already in a "CYD family" Sunton ESP32-8048S070 showed it working there too. Not sure what you mean by "swapping software serial around", software serial is not used on ESP32.

Another detail. I've seen issues inserting a SD card, but working after re-seating the card. There seemed to be a bit of transverse wiggling room in the spring-less socket.

@hagenbuch
Copy link
Author

hagenbuch commented Jul 24, 2024

Did you configure I2C pins for the SD card?

Yes, and the protocol shows the Olimex board understood:

00:00:00.001 HDW: ESP32-D0WDQ6 v1.0 
00:00:00.036 UFS: FlashFS mounted with 304 kB free
00:00:00.054 CFG: Loaded from File, Anzahl 53
00:00:00.066 QPC: Count 1
00:00:00.070 I2C: Bus1 using GPIO16(SCL) and GPIO13(SDA)
00:00:00.133 UFS: SDCard mounted (SDIO 1-bit) with 0 kB free
00:00:00.134 SCR: ufilesystem found
00:00:00.172 BRY: Berry initialized, RAM used 3184 bytes

Not sure what you mean by "swapping software serial around", software serial is not used on ESP32.

The "CYD" needs three SPI busses, two hardware busses are available and normally are being used for display (mandatory) and touchscreen. I tried to connect the touchscreen chip via "SSPI" (software SPI) so I had a hardware SPI to offer to the SDCard..

@Jason2866
Copy link
Collaborator

To track down where exactly the problem is the IDF example should be used with the problem SD Cards. If this works the issue is in Arduino code (which is an layer over IDF and uses the functions from IDF via APIs). If not IDF does not support "some" cards
https://github.com/espressif/esp-idf/tree/release/v5.1/examples/storage/sd_card/sdspi

@hagenbuch
Copy link
Author

OK I will try to "go back" to Arduino and report. It might take a little while.. thanks to all of you!

@Jason2866
Copy link
Collaborator

But yes, wrong configuring GPIOs can end in half working SD Card

@hagenbuch
Copy link
Author

hagenbuch commented Jul 24, 2024

The Olimex only offers pins 2 (which I interpret as "chip select", maybe wrongly so?), then pin 14 (Clock, obvious) and then pin 15 where I am unsure whether to configure it a s MOSI or MISO..

I tried several permutations but I am back to this to make it work:

GPIO2: SDIO D0
GPIO14: SDIO CLK
GPIO15: SDIO CMD

I'll try the official formatter next..

@hagenbuch
Copy link
Author

hagenbuch commented Jul 26, 2024

I'll give you an update:

I installed micropython 1.23 fpr ESP32 on the same Olimex board. Wifi and Ethernet work.

As an example, I provided an empty, FAT32 formatted SDHC of 4GBytes, it contained just an empty folder and a file in it.

Micropython is able to read and write the disk. In order to query the total space, I have to do this

import uos
uos.statvfs('/flash')
(4096, 4096, 968088, 968083, 968083, 0, 0, 0, 0, 255)

The third integer ist the total size, meaning 4096 * 968088 = 3781,594 MBytes. So, I would conclude that mPy is able to read the value. According to the latest release notes here:

https://micropython.org/download/OLIMEX_ESP32_POE/

it seems to use IDF version v5.0.5 or v5.2. Not exactly sure if that gives you the right hints.

If there is a debug version to install or other debug method, I would be happy to use it..

@s-hadinger
Copy link
Collaborator

I will look as well. I'm wondering if it's linked to some weird formatting options. Since all your SD cards show the same problem, it could be linked to the way you formatted them in the first place. How did you proceed?

@hagenbuch
Copy link
Author

Different devices but I guess, most of them Linux. I will try the official formatter on Windows but I am on my way to a week of holidays, will report back. Thanks so far!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arduino Core Type - Issue / feature is related to Arduino Core wont/can't fix Result - Requested that can't be fixed/added or it is outside scope
Projects
None yet
Development

No branches or pull requests

4 participants