atomic14 / diy-esp32-epub-reader

An ESP32 e-reader
MIT License
340 stars 47 forks source link

EPDiy reading SPI microSD #56

Closed martinberlin closed 2 years ago

martinberlin commented 2 years ago

Updated the ADC channel: ; Adc channel that is connected to the battery voltage divider - this is GPIO_NUM_34 in EPDiy V6 -D BATTERY_ADC_CHANNEL=ADC1_CHANNEL_6

But still shows the battery empty. I was told the voltage divider was connected to IO 34. Got it there is a bridge I need to close in the PCB, will document it later in the Wiki. schematic-v6.pdf

Related to #60

martinberlin commented 2 years ago

Reopening this since the right pins are not still in place. Will close it after it's tested and working.

martinberlin commented 2 years ago

@cgreening I don't understand what is going on SD card seems mounted but is not reading the ePub's screen stays blank. Maybe you can see something that I overseen:

I (1793) main: Starting file system
I (1793) main: Using SDCard
I (1793) SDC: Initializing SD card
I (1793) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (1803) sdspi_transaction: cmd=52, R1 response: command not supported
I (1853) sdspi_transaction: cmd=5, R1 response: command not supported
Name: SC16G
Type: SDHC/SDXC
Speed: 20 MHz
Size: 15193MB
I (1893) main: Starting battery monitor
I (1893) main: Setting up controls
E (1893) gpio: gpio_install_isr_service(460): GPIO isr service already installed
I (1903) main: Controls configured
I (1913) EPD: Full clear
I (3363) main: Creating epub list
I (3513) main: Epub files loaded
I (3513) PUBLIST: Current page is 0, previous page -1, redraw=1

// Stays there on white screen, just battery drawn. PIN CONFIG
  ; setup the pins for the SDCard. Attention with GPIO_NUM_12 (boot fail if pulled high)
  -DSD_CARD_PIN_NUM_MISO=GPIO_NUM_36
  -DSD_CARD_PIN_NUM_MOSI=GPIO_NUM_0
  -DSD_CARD_PIN_NUM_CLK=GPIO_NUM_13
  -DSD_CARD_PIN_NUM_CS=GPIO_NUM_14

Tried with a standalone ESP32 and the SD card demo and it works. But using different pins. Is OK that MISO is input only?

cgreening commented 2 years ago

Hmm, add some logging into the EpubList.cpp file around the load method. It should be logging out a bunch of stuff already but maybe the debug log is turned off?

On Fri, Nov 5, 2021 at 1:09 PM Martin @.***> wrote:

@cgreening https://github.com/cgreening I don't understand what is going on SD card seems mounted but is not reading the ePub's screen stays blank. Maybe you can see something that I overseen:

I (1793) main: Starting file system I (1793) main: Using SDCard I (1793) SDC: Initializing SD card I (1793) gpio: GPIO[14]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (1803) sdspi_transaction: cmd=52, R1 response: command not supported I (1853) sdspi_transaction: cmd=5, R1 response: command not supported Name: SC16G Type: SDHC/SDXC Speed: 20 MHz Size: 15193MB I (1893) main: Starting battery monitor I (1893) main: Setting up controls E (1893) gpio: gpio_install_isr_service(460): GPIO isr service already installed I (1903) main: Controls configured I (1913) EPD: Full clear I (3363) main: Creating epub list I (3513) main: Epub files loaded I (3513) PUBLIST: Current page is 0, previous page -1, redraw=1

// Stays there on white screen, just battery drawn. PIN CONFIG ; setup the pins for the SDCard. Attention with GPIO_NUM_12 (boot fail if pulled high) -DSD_CARD_PIN_NUM_MISO=GPIO_NUM_36 -DSD_CARD_PIN_NUM_MOSI=GPIO_NUM_0 -DSD_CARD_PIN_NUM_CLK=GPIO_NUM_13 -DSD_CARD_PIN_NUM_CS=GPIO_NUM_14

Tried with a standalone ESP32 and the SD card demo and it works. But using different pins. Is OK that MISO is input only?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/atomic14/diy-esp32-epub-reader/issues/56#issuecomment-961881886, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMTADIRARZKTLWSGRG4L3UKPJPVANCNFSM5GYQDUXA .

martinberlin commented 2 years ago

Ahhm but the Epub need to be in the /fs folder or just in the root folder? I (3373) PUBLIST: Load called: /fs/ I (3513) main: Epub files loaded I (3513) PUBLIST: Current page is 0, previous page -1, redraw=1

cgreening commented 2 years ago

Just in the root folder.

/fs/ is where the SDCard is mounted.

On Fri, Nov 5, 2021 at 1:42 PM Martin @.***> wrote:

Ahhm but the Epub need to be in the /fs folder or just in the root folder? I (3373) PUBLIST: Load called: /fs/ I (3513) main: Epub files loaded I (3513) PUBLIST: Current page is 0, previous page -1, redraw=1

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/atomic14/diy-esp32-epub-reader/issues/56#issuecomment-961904700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFMTAHHZSA55MPKGMDOZ7DUKPNNXANCNFSM5GYQDUXA .

martinberlin commented 2 years ago

ok I see. Is not entering here:

while ((ent = readdir(dir)) != NULL)
    {
      ESP_LOGD(TAG, "Found file: %s", ent->d_name);
    } 

Is strange because like I commented before without EPDiy and the SDcard demo seems to work and it writes a FOO.txt and then it opens it. Will try later with same PIN config but outside the EPDiy board.

martinberlin commented 2 years ago

@cgreening after debugging more I found out what it is:

For me the culprit is this comparison to check the extension of the file: strcmp(ent->d_name + name_length - 5, ".epub")

That is not working for me in the SD card mode. Note that the name of this particular file that I don't know why you see reduced and in CAPS on Serial is: "poesia_aPizz.epub" (Lenght is 12 but without extension)

Hence this comparision returns a 3 as an output failing to detect the file is a valid Epub. There must be another way to detect an extension. Commenting this comparison I see the book is being listed.

I (3523) PUBLIST: Found file: POESIA~1.EPU
I (3523) PUBLIST: File: POESIA~1.EPU length 12 is not .epub 3
martinberlin commented 2 years ago

This is working an expected in feature/epdiy-v6 branch. I don't think it needs merging since only the pins in Platformio are changed. Otherwise we can reopen it again anytime.

martinberlin commented 2 years ago

sd-card