Audio board init with ESP32-WROVER_IB (16MB)

Ismael
Posts: 20
Joined: Thu Mar 05, 2020 7:35 am

Audio board init with ESP32-WROVER_IB (16MB)

Postby Ismael » Fri Mar 20, 2020 11:38 am

Hello

In our project board we've using module ESP32-WROVER-IB with 16MB of Flash. To reproduce audio our board has the same esquema of the LyraT_v4.3 with some pins changes.
The issue is that the MP3 simple example works perfect buf when I tried to enable external SPI RAM (default conf), it doesn't work.

To add more information, configuration file is attached and the pin changes of our custom board are:

Code: Select all

	HEADPHONE_DETCET          GPIO_NUM_16
        PA_ENABLE_GPIO            GPIO_NUM_17

	i2c_config->sda_io_num = GPIO_NUM_32;
        i2c_config->scl_io_num = GPIO_NUM_33;

	i2s_config->bck_io_num = GPIO_NUM_5;
        i2s_config->ws_io_num = GPIO_NUM_25;
        i2s_config->data_out_num = GPIO_NUM_26;
        i2s_config->data_in_num = GPIO_NUM_35;

And in i2s_mclk_gpio_select function gpio_num is forced to: gpio_num = GPIO_NUM_1; 
Here is the trace of the problem:

Code: Select all

Rebooting...                                                                    
ets Jun  8 2016 00:22:57                                                        
                                                                                
rst:0xc (SW_CPU_RESET),boot:0x17 (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:6980                                                        
load:0x40078000,len:12072                                                       
load:0x40080400,len:6908                                                        
entry 0x4008079c                                                                
I (72) boot: Chip Revision: 1                                                   
I (72) boot_comm: chip revision: 1, min. bootloader chip revision: 0            
I (39) boot: ESP-IDF v3.3.1-211-g6f9a7264c 2nd stage bootloader                 
I (39) boot: compile time 12:26:57                                              
I (40) boot: Enabling RNG early entropy source...                               
I (44) boot: SPI Speed      : 40MHz                                             
I (48) boot: SPI Mode       : DIO                                               
I (52) boot: SPI Flash Size : 16MB                                              
I (57) boot: Partition Table:                                                   
I (60) boot: ## Label            Usage          Type ST Offset   Length         
I (67) boot:  0 nvs              WiFi data        01 02 00009000 00004000       
I (75) boot:  1 otadata          OTA data         01 00 0000d000 00002000       
I (82) boot:  2 phy_init         RF data          01 01 0000f000 00001000       
I (90) boot:  3 factory          factory app      00 00 00010000 00200000       
I (97) boot: End of partition table                                             
I (101) boot: Defaulting to factory image                                       
I (106) boot_comm: chip revision: 1, min. application chip revision: 0          
I (113) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x2c254 (18
0820) map                                                                       
I (186) esp_image: segment 1: paddr=0x0003c27c vaddr=0x3ffb0000 size=0x020ac (  
8364) load                                                                      
I (189) esp_image: segment 2: paddr=0x0003e330 vaddr=0x40080000 size=0x00400 (  
1024) load                                                                      
I (193) esp_image: segment 3: paddr=0x0003e738 vaddr=0x40080400 size=0x018d8 (  
6360) load                                                                      
I (204) esp_image: segment 4: paddr=0x00040018 vaddr=0x400d0018 size=0x2a32c (17
2844) map                                                                       
I (271) esp_image: segment 5: paddr=0x0006a34c vaddr=0x40081cd8 size=0x0d910 ( 5
5568) load                                                                      
I (303) boot: Loaded app from partition at offset 0x10000                       
I (303) boot: Disabling RNG early entropy source...                             
I (304) psram: This chip is ESP32-D0WD                                          
I (310) spiram: Found 64MBit SPI RAM device                                     
I (313) spiram: SPI RAM mode: flash 40m sram 40m                                
I (318) spiram: PSRAM initialized, cache is in low/high (2-core) mode.          
I (326) cpu_start: Pro cpu up.                                                  
I (329) cpu_start: Application information:                                     
I (334) cpu_start: Project name:     play_mp3                                   
I (339) cpu_start: App version:      v2.0-beta3-25-g11b626c-dirty               
I (346) cpu_start: Compile time:     Mar 20 2020 12:27:01                       
I (352) cpu_start: ELF file SHA256:  030bab1bcf69d565...                        
I (358) cpu_start: ESP-IDF:          v3.3.1-211-g6f9a7264c                      
I (364) cpu_start: Starting app cpu, entry point is 0x40081480                  
I (351) cpu_start: App cpu up.                                                  
I (1255) spiram: SPI SRAM memory test OK                                        
I (1256) heap_init: Initializing. RAM available for dynamic allocation:         
I (1256) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM                      
I (1262) heap_init: At 3FFB31A8 len 0002CE58 (179 KiB): DRAM                    
I (1268) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM                   
I (1275) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM                  
I (1281) heap_init: At 4008F5E8 len 00010A18 (66 KiB): IRAM                     
I (1288) cpu_start: Pro cpu start user code                                     
I (1293) spiram: Adding pool of 4096K of external SPI memory to heap allocator  
I (307) cpu_start: Starting scheduler on PRO CPU.                               
I (0) cpu_start: Starting scheduler on APP CPU.                                 
I (309) spiram: Reserving pool of 32K of internal memory for DMA/internal alloca
tions                                                                           
I (309) PLAY_MP3_FLASH: [ 1 ] Start audio codec chip                            
I (339) PLAY_MP3_FLASH: [ 2 ] Create audio pipeline, add all elements to pipelin
e, and subscribe pipeline event                                                 
I (339) PLAY_MP3_FLASH: [2.1] Create mp3 decoder to decode mp3 file and set cust
om read callback                                                                
I (349) PLAY_MP3_FLASH: [2.2] Create i2s stream to write data to codec chip     
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandle
d.                                                                              
Core 0 register dump:                                                           
PC      : 0x4008efdf  PS      : 0x00060730  A0      : 0x80084df8  A1      : 0x3f
fb4c30                                                                          
A2      : 0x3f800000  A3      : 0x000000d0  A4      : 0x00000000  A5      : 0x00
070c80                                                                          
A6      : 0x00000102  A7      : 0x00000000  A8      : 0x00000000  A9      : 0xff
ffffff                                                                          
A10     : 0x3f800010  A11     : 0x00060b23  A12     : 0x3f800014  A13     : 0x00
000000                                                                          
A14     : 0xffffffff  A15     : 0x00000000  SAR     : 0x00000014  EXCCAUSE: 0x00
00001c                                                                          
EXCVADDR: 0xffffffff  LBEG    : 0x400029ac  LEND    : 0x400029cb  LCOUNT  : 0x00
000000                                                                          
                                                                                
ELF file SHA256: 030bab1bcf69d565fb644b99ef2d079b4719c4fe72ca85eb1e50b1d08e9faa6
c                                                                               
                                                                                
Backtrace: 0x4008efdf:0x3ffb4c30 0x40084df5:0x3ffb4c50 0x400ea3a4:0x3ffb4c70 0x4
00e9215:0x3ffb4c90 0x400eaa24:0x3ffb4d20 0x400d64b6:0x3ffb4de0 0x400d17e4:0x3ffb
4ef0 0x4008c1b1:0x3ffb4f10                                                      
                                                                                
Rebooting... 

Thanks so much.
Attachments
sdkconfig.txt
(22.7 KiB) Downloaded 546 times

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Audio board init with ESP32-WROVER_IB (16MB)

Postby ESP_Sprite » Sun Mar 22, 2020 12:11 pm

Hard to say, but it would probably help if you could decode that register dump.

Ismael
Posts: 20
Joined: Thu Mar 05, 2020 7:35 am

Re: Audio board init with ESP32-WROVER_IB (16MB)

Postby Ismael » Mon Mar 23, 2020 8:48 am

Hello ESP_Sprite,
Thanks for your reply.
I'm trying to get the translations of those registers but I'm having some problems with openocd + xtensa over eclipse debugging.
The code that is running is the examples/get-started/play_mp3 with the only modification of the SRAM enabled.
In case I achieve your request, I will it write back.
Thanks so much.

Ismael
Posts: 20
Joined: Thu Mar 05, 2020 7:35 am

Re: Audio board init with ESP32-WROVER_IB (16MB)

Postby Ismael » Mon Mar 23, 2020 10:38 am

Hello again,
After analyzing the map file and the call backtrace, the program reset in function: multi_heap_malloc_impl.
Program trace is:
multi_heap_malloc_impl -> heap_caps_malloc -> audio_calloc -> audio_element_init -> i2s_stream_init -> app_main

Thanks so much.

ESP_Sprite
Posts: 9711
Joined: Thu Nov 26, 2015 4:08 am

Re: Audio board init with ESP32-WROVER_IB (16MB)

Postby ESP_Sprite » Mon Mar 23, 2020 6:26 pm

Ah, I missed the smoking gun the first time:

Code: Select all

        HEADPHONE_DETCET          GPIO_NUM_16
        PA_ENABLE_GPIO            GPIO_NUM_17
Apart from your creative spelling of the word 'detect', the problem with this code is that GPIO16 and 17 are used by the PSRAM, and re-using them as something else will lead to issues like you have seen.

Ismael
Posts: 20
Joined: Thu Mar 05, 2020 7:35 am

Re: Audio board init with ESP32-WROVER_IB (16MB)

Postby Ismael » Tue Mar 24, 2020 8:54 am

Thanks so much ESP_Sprite for the answer. It solve my problem.
Have a nice day.

Who is online

Users browsing this forum: No registered users and 7 guests