karawin / Ka-Radio32

esp32 version of Ka-Radio (https://github.com/karawin/Ka-Radio) by jp Cocatrix
517 stars 155 forks source link

ESP32-COLOR-ADB hangs when SSD1331 was enabled #26

Closed makserge closed 6 years ago

makserge commented 6 years ago

Hello. I have a trouble with ESP32-COLOR-ADB from Microwavemont (tindie.com). This board have PCM5102 DAC and SSD1331 OLED on board.

I checked out this project and flashed it this board with default configuration. Opened web interface and setup wifi connection and loaded my playlist. After reboot I was able to connect to web interface and play radio. OLED was disabled at all.

Than I tried to enable OLED by changing SPI pins for OLED

in main/include/gpio.h this way

@@ -48,9 +48,9 @@ // SPI lcd //--------- // HSPI pins + -#define PIN_LCD_CS GPIO_NUM_13 //CS -#define PIN_LCD_A0 GPIO_NUM_14 //A0 or D/C -#define PIN_LCD_RST GPIO_NUM_2 //Reset RES RST or not used +#define PIN_LCD_CS GPIO_NUM_5 //CS +#define PIN_LCD_A0 GPIO_NUM_16 //A0 or D/C +#define PIN_LCD_RST GPIO_NUM_17 //Reset RES RST or not used

and flash updated code to the board

Than I set current LCD type via telnet

sys.lcd("197");

and reboot

OLED shows some info and blinking once in 2 seconds.

Board can't connect to the wifi and doesn't respond to web requests, telnet and even ping to its IP.

Could you help with issue? Should I change something else to enable OLED on this board? Is my OLED pins configuration OK?

Board pin assignment is here https://cdn.tindiemedia.com/images/resize/qOo86qvwCBgHBnt77bsAibHUS6k=/p/fit-in/1300x866/filters:fill(fff)/i/73055/products/2018-02-08T01%3A02%3A33.164Z-ESP32-ad2.png

Another question, can I change default LCD type to 197 instead of default 0? Where is right place in code to set this type?

karawin commented 6 years ago

I need the log of the uart. The default lcd is kept on the config. No need to change it at each reboot. You need to change the gpio in conflict ie knob etc....

makserge commented 6 years ago

I was able to get log from begiinning of boot

ets Jun 8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) flash read err, 1000 ets_main.c 371 ets Jun 8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:2 load:0x3fff0018,len:4 load:0x3fff001c,len:3068 load:0x40078000,len:0 load:0x40078000,len:12784 entry 0x40078c90 I (375) cpu_start: Pro cpu up. I (375) cpu_start: Starting app cpu, entry point is 0x400815c4 I (0) cpu_start: App cpu up. I (376) heap_init: Initializing. RAM available for dynamic allocation: D (381) heap_init: New heap initialised at 0x3ffae6e0 I (386) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM D (391) heap_init: New heap initialised at 0x3ffc9630 I (395) heap_init: At 3FFC9630 len 000169D0 (90 KiB): DRAM I (401) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM I (406) heap_init: At 3FFE4350 len 00013CB0 (79 KiB): D/IRAM D (411) heap_init: New heap initialised at 0x40094f1c I (416) heap_init: At 40094F1C len 0000B0E4 (44 KiB): IRAM I (421) cpu_start: Pro cpu start user code D (433) clk: RTC_SLOW_CLK calibration value: 3481626 V (106) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args V (106) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE D (111) intr_alloc: Connected src 46 to int 2 (cpu 0) V (116) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args V (121) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xC0E D (129) intr_alloc: Connected src 57 to int 3 (cpu 0) I (134) esp_apptrace: Initialized TRAX on CPU0 D (138) stack_chk: Intialize random stack guard V (142) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args V (148) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x40E D (156) intr_alloc: Connected src 24 to int 9 (cpu 0) I (161) cpu_start: Starting scheduler on PRO CPU. I (92) esp_apptrace: Initialized TRAX on CPU1 V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): checking args V (0) intr_alloc: esp_intr_alloc_intrstatus (cpu 1): Args okay. Resulting flags 0x40E D (10) intr_alloc: Connected src 25 to int 2 (cpu 1) I (20) cpu_start: Starting scheduler on APP CPU. D (212) heap_init: New heap initialised at 0x3ffe0440 D (222) heap_init: New heap initialised at 0x3ffe4350 V (222) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args V (222) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0xE D (222) intr_alloc: Connected src 16 to int 12 (cpu 0) I (242) main: starting app_main() I (242) main: RAM left: 170748 E (252) main: Running partition type 0 subtype 16 (offset 0x00010000) D (252) nvs: nvs_flash_init_custom partition=nvs start=9 count=4 I (282) main: Partition init done... Log level is now ESP_LOG_INFO V (392) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): checking args V (392) intr_alloc: esp_intr_alloc_intrstatus (cpu 0): Args okay. Resulting flags 0x80E D (392) intr_alloc: Connected src 30 to int 13 (cpu 0) I (402) gpio: GPIO[12]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (412) gpio: GPIO[34]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:0 E (1912) vs1053: NO VS1053 detected I (1912) main: hardware initialized I (1912) main: Hardware init done... E (1912) main: LCD Type 197 I (1912) addonucg: lcd init type: 197 I (1912) ucg_hal: UCG_COM_MSG_POWER_UP: 50 ns so in Hz: 20000000 I (1922) gpio: GPIO[16]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (1922) gpio: GPIO[17]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (1

END OF LOG

My current gpio.h doesn't have repeating pin definitions

pragma once

ifndef __GPIO_H__

define __GPIO_H__

//-------------------------------// // Define GPIO used in KaRadio32 // //-------------------------------// // Compatible ESP32 ADB // https://www.tindie.com/products/microwavemont/esp32-audio-developing-board-esp32-adb/

// HSPI pins //-----------

define PIN_NUM_MISO GPIO_NUM_19 // Master Input, Slave Output

define PIN_NUM_MOSI GPIO_NUM_23 // Master Output, Slave Input Named Data or SDA or D1 for oled

define PIN_NUM_CLK GPIO_NUM_18 // Master clock Named SCL or SCK or D0 for oled

// status led if any. //------------------- //Set the right one with command sys.led // GPIO can be changed with command sys.ledgpio("x")

define GPIO_LED GPIO_NUM_12 // Flashing led or Playing led

// gpio of the vs1053 //-------------------

define PIN_NUM_XCS GPIO_NUM_32

define PIN_NUM_RST GPIO_NUM_12

define PIN_NUM_XDCS GPIO_NUM_33

define PIN_NUM_DREQ GPIO_NUM_34

// + HSPI pins

// Encoder knob //-------------

define PIN_ENC_A GPIO_NUM_35 // CLK

define PIN_ENC_B GPIO_NUM_14 // DT

define PIN_ENC_BTN GPIO_NUM_2 // SW

// I2C lcd (and rda5807 if lcd is i2c or LCD_NONE) //------------------------------------------------

define PIN_I2C_SCL GPIO_NUM_5

define PIN_I2C_SDA GPIO_NUM_16

define PIN_I2C_RST GPIO_NUM_17 // or not used

// I2C rda5807 (if lcd is spi) //----------------------------

define PIN_SI2C_SCL GPIO_NUM_15

define PIN_SI2C_SDA GPIO_NUM_27

// SPI lcd //--------- // HSPI pins +

define PIN_LCD_CS GPIO_NUM_5 //CS

define PIN_LCD_A0 GPIO_NUM_16 //A0 or D/C

define PIN_LCD_RST GPIO_NUM_17 //Reset RES RST or not used

// IR Signal //-----------

define PIN_IR_SIGNAL GPIO_NUM_21 // Remote IR source

// I2S DAC or PDM output //-----------------------

define PIN_I2S_LRCK GPIO_NUM_25 // or Channel1

define PIN_I2S_BCLK GPIO_NUM_26 // or channel2

define PIN_I2S_DATA GPIO_NUM_22

// to set a value: gpio_set_level(gpio_num_t gpio_num,value); // to read a value: int gpio_get_level(gpio_num_t gpio_num)

void gpio_output_conf(gpio_num_t gpio);

endif

makserge commented 6 years ago

Fixed this issue.

Tips:

  1. Use different pins for SPI and I2C displays even for SPI display config (it seems it is not logical for me)
  2. Use good USB cable since board consumes up to 250 mA when connected to Wi-Fi and plays music with display enabled.

It is correct gpis.h for this board (https://www.tindie.com/products/microwavemont/esp32-color-adb) https://github.com/makserge/Ka-Radio32/blob/master/main/include/gpio.h

gojimmypi commented 5 years ago

Is VSPI actually pins //SCLK = 18, MISO = 19, MOSI = 23, SS = 5 and HSPI pins //SCLK = 14, MISO = 12, MOSI = 13, SS = 15 ?

See this example.

I ask, as my VSPI is unavailable (different board: WROOM-32), and I am unable to get HSPI working; I'd like the performance of HWSPI, and not do software SPI (which I can get working, but is considerably slower)

Thanks in advance for any word of wisdom on this topic. :)