Edzelf / ESP32Radio-V2

New version of the well known ESP32 Radio. Now optional I2S output!
Apache License 2.0
182 stars 45 forks source link

Audio stream stopps after changing preselected station , reboot need #146

Open thb584Git opened 2 months ago

thb584Git commented 2 months ago

If have some issues with my ESp32-Radio design and need advice. Designed a PCB 2 years ago (you can find in this post). However my wife decided to stay with the installed kitchen radio so I put it on the shelf. Now there is demand to go "productive" an I installed the lasted version (not the release V1.0).

HW: NodeMCU-32S, pHAT_I²S-DAC(PCM5102), OLED Display SSD1306, rotary encoder + 4 Buttons

First issue, not really a problem just strange and maybe related. The define for FIXEDWIFI in config.h is ignored. The board always comes up with its predefined AP and IP.

Modifying the preferences via web-interface works. After reboot It connects to my Wifi-AP and the audio stream is playing, but...

And this is the main issue. After turning on audio is o.k. Not changing the preselected station it will be playing for hours. On changing the station it keeps is playing as well but only if the station tuning was done a short time after boot.

To be more recise, you can change the preselect several times until you stayed tuned to a station for some minutes. By switching to another station then the audio stops. Test feature throws e.g. "Free memory is 47092/98324, chunks in queue 0, bitrate 3426287 kbps". Behavior is the same using web commands, buttons or rotary encoder for preselect.

Volume Buttons and rotary encoders are still working and display information is as expected except no Stream content information. Audio will not work before a reset was applied.

Configuation:

//***************************************************************************************************
// config.h                                                                                         *
//***************************************************************************************************
//
//#define NAME "ESP32-Radio"                              // Define name of the radio, also AP SSID
                                                          // Default is "ESP32-Radio"

//#define SDCARD                                          // For SD card support (reading MP3-files)

#define FIXEDWIFI "DA*****/4*****!"   // Add a fixed SSID to the list

// Define (just one) type of MP3/AAC decoder
//#define DEC_VS1053                                        // Hardware decoder for MP3, AAC, OGG
//#define DEC_VS1003                                      // Hardware decoder for MP3
#define DEC_HELIX                                         // Software decoder for MP3, AAC. I2S output
//#define DEC_HELIX_INT                                   // Software decoder for MP3, AAC. DAC output
                                                          // Needs platform = espressif32@3.1.0 !!!!

// Define (just one) type of display.  See documentation.
//#define BLUETFT                                           // Works also for RED TFT 128x160
//#define ST7789                                          // 240x240 TFT
#define OLED1306                                        // 64x128 I2C OLED SSD1306
//#define OLED1309                                        // 64x128 I2C OLED SSD1309
//#define OLED1106                                        // 64x128 I2C OLED SH1106
//#define DUMMYTFT                                        // Dummy display
//#define LCD1602I2C                                      // LCD 1602 display with I2C backpack
//#define LCD2004I2C                                      // LCD 2004 display with I2C backpack
//#define ILI9341                                         // ILI9341 240*320
//#define NEXTION                                         // Nextion display. Uses UART 2 (pin 16 and 17)
//

// Define ZIPPYB5 if a ZIPPY B5 Side Switch is used instead of a rotary switch
///#define ZIPPYB5

// End of configuration parameters.

// DEC_HELIX_INT does not seem to work with higher versions of framework.  Do a test.
#ifdef DEC_HELIX_INT
  #if ESP_ARDUINO_VERSION_MAJOR >= 2
    #error Internal DAC will not work in this version of the platform.  Use espressif32@3.1.0.
  #endif
#endif
($)pin_i2s_bck = 5                                     # GPIO Pin number for I2S "BCK"
($)pin_i2s_din = 4                                     # GPIO Pin number for I2S "DIN"
($)pin_i2s_lck = 32                                    # GPIO Pin number for I2S "L(R)CK"
#
batt0 = 2600
batt100 = 2950
#
clk_dst = 1                                          # Offset during daylight saving time (hours)
clk_offset = 1                                       # Offset with respect to UTC in hours
clk_server = pool.ntp.org                            # Time server to be used
#
gpio_00 = upvolume= 3
gpio_12 = mute
gpio_13 = uppreset= 1
gpio_34 = downpreset = 1
gpio_39 = downvolume= 3
#
ir_18E7 = upvolume = 3
ir_4AB5 = downvolume = 4
ir_629D = station = liveradio.swr.de/sw282p3/swr3/play.mp3
ir_6897 = station = liveradio.swr.de/sw282p3/swr1rp/play.mp3
ir_9867 = station = liveradio.swr.de/sw282p3/swr1rp/play.mp3
ir_A25D = station = dispatcher.rndfnk.com/br/br3/live/mp3/mid
ir_B04F = mute
ir_E21D = station = mp3channels.webradio.antenne.de/antenne
#
mqttbroker = 192.168.0.2
mqttpasswd = none
mqttport = 1883
mqttprefix = radio1
mqttuser = none
#
pin_enc_clk = 25                                     # GPIO Pin number for rotary encoder "CLK"
pin_enc_dt = 26                                      # GPIO Pin number for rotary encoder "DT"
pin_enc_sw = 27                                      # GPIO Pin number for rotary encoder "SW"
pin_ir = 35                                          # GPIO Pin number for IR receiver VS1838B
pin_tft_scl = 22                                     # GPIO Pin number for I2S SCL (SSD1306 Display)
pin_tft_sda = 21                                     # GPIO Pin number for I2S SDA (SSD1306 Display)
#
preset = 0
preset_00 = liveradio.swr.de/sw282p3/swr1rp/play.mp3 #  0 - SWR1 RP
preset_01 = liveradio.swr.de/sw282p3/swr3/play.mp3   #  1 - SWR3
preset_02 = dispatcher.rndfnk.com/br/br3/live/mp3/low#  2 - BR3
preset_03 = stream.antenne.de/antenne/stream/mp3     #  3 - Antenne Bayern
preset_04 = uk3.internet-radio.com:8405/live         #  4 - Majestic Jukebox Radios
preset_05 = uk5.internet-radio.com:8174              #  5 - Joy Radio
preset_06 = addrad.io/44559h5                        #  6 - Radio Gong
preset_07 = dispatcher.rndfnk.com/swr/swr1/rp/mp3/128/stream.mp3 #  7 - SWR1 RP
preset_08 = 4534.cloudrad.io:8284/                   #  8 - Serenade Radio
#
toneha = 0
tonehf = 0
tonela = 0
tonelf = 0
#
volume = 33
#
wifi_00 = D***N/4***!
wifi_01 = D***G/4***!

platformio.ini:

[env:esp32]
platform = espressif32
;platform = espressif32@3.1.0
;board = esp-wrover-kit
board = nodemcu-32s
framework = arduino
board_build.partitions = radiopart.csv
upload_port = COM5
;upload_protocol = espota       ; OTA must be enabled in the running version, see config.h
;upload_port = 192.168.2.18     ; Adjust to the IP of the radio
monitor_port = COM5
monitor_speed = 115200
monitor_dtr = 0
monitor_rts = 0
monitor_filters = esp32_exception_decoder
monitor_echo = yes
build_flags =
    -DCORE_DEBUG_LEVEL=5    ; Set to 0 for no debug; saves memory
                                ; Set to 5 for full debug
    -Os
;   -Wl,-Map,ESP32-Radio.map
lib_ldf_mode = chain+       ; Obey #include lines
lib_deps = 
  Wire
  knolleary/PubSubClient@^2.8
  adafruit/Adafruit BusIO@^1.9.3
  adafruit/Adafruit GFX Library@^1.10.4
  adafruit/Adafruit ILI9341@^1.5.9
  adafruit/Adafruit ST7735 and ST7789 Library@^1.7.5
  me-no-dev/AsyncTCP@1.1.1
  me-no-dev/ESP Async WebServer@^1.2.3
  yveaux/AC101@^0.0.1
  djuseeq/Ch376msc @ ^1.4.4

Even the debug level configured seems to be full the information I get is not much. This is for a boot and applying a station change and Test command using the web interface.

Esp32ExceptionDecoder: disabling, firmware at E:\Privatdaten\thomas\PioProjects\ESP32_Radio_Test\.pio\build\esp32\firmware.elf does not exist, rebuild the project?    
--- Terminal on COM5 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[ 21083][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 21400][I][mp3_decoder.cpp:1643] DecodeHuffmanPairs(): (tabType != invalidTab)
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_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:0x3fff0030,len:184
load:0x40078000,len:12732
ho 0 tail 12 room 4
load:0x40080400,len:2908
entry 0x400805c4
[     5][D][esp32-hal-cpu.c:244] setCpuFrequencyMhz(): PLL: 480 / 2 = 240 Mhz, APB: 80000000 Hz

Starting ESP32-radio running on CPU 1 at 240 MHz.
[  3366][I][esp32-hal-i2c.c:75] i2cInit(): Initialising I2C Master: sda=21 scl=22 freq=100000
I2C buf is 128
[  3470][I][WiFiMulti.cpp:85] addAP(): [WIFI][APlistAdd] add SSID: DATALAN
[  3471][I][WiFiMulti.cpp:85] addAP(): [WIFI][APlistAdd] add SSID: DATALAN
[  3473][I][WiFiMulti.cpp:85] addAP(): [WIFI][APlistAdd] add SSID: DATALAN-PRO-2.4G
[  3993][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  4088][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[  4088][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 2 - STA_START
[  4637][V][WiFiGeneric.cpp:343] _arduino_event_cb(): STA Stopped
[  4638][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 3 - STA_STOP
[  5648][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 0 - WIFI_READY
[  5652][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
[  5652][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 2 - STA_START
[ 12664][V][WiFiGeneric.cpp:383] _arduino_event_cb(): SCAN Done: ID: 128, Status: 0, Results: 5
[ 12664][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 1 - SCAN_DONE
[ 12669][I][WiFiMulti.cpp:115] run(): [WIFI] scan done
[ 12674][I][WiFiMulti.cpp:120] run(): [WIFI] 5 networks found
[ 12679][D][WiFiMulti.cpp:150] run():  --->   0: [1][DC:39:6F:B0:62:F4] DATALAN (-53) *
[ 12687][D][WiFiMulti.cpp:150] run():  --->   1: [1][1C:BF:CE:25:54:98] DATALAN-PRO-2.4G (-75) *
[ 12695][D][WiFiMulti.cpp:152] run():        2: [1][00:1C:10:A9:1E:AF] audiolan (-79) *
[ 12703][D][WiFiMulti.cpp:152] run():        3: [6][08:96:D7:B2:B4:E0] HomeME (-89) *
[ 12711][D][WiFiMulti.cpp:152] run():        4: [6][0A:96:D7:B2:B4:E0] Mechler Office Gast (-90) *
[ 12719][I][WiFiMulti.cpp:161] run(): [WIFI] Connecting BSSID: DC:39:6F:B0:62:F4 SSID: DATALAN Channel: 1 (-53)
[ 12730][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[ 13220][V][WiFiGeneric.cpp:362] _arduino_event_cb(): STA Disconnected: SSID: DATALAN, BSSID: dc:39:6f:b0:62:f4, Reason: 202
[ 13221][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[ 13228][W][WiFiGeneric.cpp:1057] _eventCallback(): Reason: 202 - AUTH_FAIL
[ 13235][D][WiFiGeneric.cpp:1077] _eventCallback(): WiFi Reconnect Running
[ 13242][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
[ 13776][V][WiFiGeneric.cpp:355] _arduino_event_cb(): STA Connected: SSID: DATALAN, BSSID: dc:39:6f:b0:62:f4, Channel: 1, Auth: WPA_WPA2_PSK
[ 13778][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[ 13824][V][WiFiGeneric.cpp:369] _arduino_event_cb(): STA Got New IP:192.168.0.126
[ 13825][D][WiFiGeneric.cpp:1035] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[ 13828][D][WiFiGeneric.cpp:1098] _eventCallback(): STA IP: 192.168.0.126, MASK: 255.255.255.0, GW: 192.168.0.1
[ 13838][I][WiFiMulti.cpp:177] run(): [WIFI] Connecting done.
[ 13843][D][WiFiMulti.cpp:178] run(): [WIFI] SSID: DATALAN
[ 13849][D][WiFiMulti.cpp:179] run(): [WIFI] IP: 192.168.0.126
[ 13854][D][WiFiMulti.cpp:180] run(): [WIFI] MAC: DC:39:6F:B0:62:F4
[ 13860][D][WiFiMulti.cpp:181] run(): [WIFI] Channel: 1
[ 18134][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 68396][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 68935][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 71184][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
Stack loopTask is 6004
Stack Playtask is  616
ADC reading is 0, filtered 20
16 IR interrupts seen
[ 78977][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 84017][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
[ 89034][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
thb584Git commented 2 months ago

Did more testing, built a second device using the latest release I had in my git local repo (GITEA) from two years ago:

Here the Log-file for boot and one working preset change and a second one failing

D: Starting ESP32-radio running on CPU 1 at 240 MHz.
D: Version Sun, 15 May 2022 10:30:00 GMT.  Free memory 110580
D: Display type is OLED
D: SPIFFS is okay, space 1318001, used 33634
D: Found partition 'nvs     ' at offset 0x009000 with size    20480
D: Found partition 'otadata ' at offset 0x00E000 with size     8192
D: Found partition 'spiffs  ' at offset 0x290000 with size  1441792
D: Found partition 'coredump' at offset 0x3F0000 with size    65536
D: Read 46 keys from NVS
D: pin_ir set to 35
D: pin_enc_clk set to 25
D: pin_enc_dt set to 26
D: pin_enc_sw set to 27
D: pin_tft_scl set to 22
D: pin_tft_sda set to 21
D: pin_i2s_bck set to 5
D: pin_i2s_lck set to 32
D: pin_i2s_din set to 4
D: pin_spi_sck set to 18
D: pin_spi_miso set to 19
D: pin_spi_mosi set to 23
D: GPIO0 is HIGH
D: GPIO2 is HIGH
D: GPIO4 is HIGH
D: GPIO5 is HIGH
D: GPIO12 is HIGH
D: GPIO13 is HIGH
D: GPIO14 is HIGH
D: GPIO15 is HIGH
D: GPIO16 is HIGH
D: GPIO17 is HIGH
D: GPIO18 is HIGH
D: GPIO19 is HIGH
D: GPIO21 is HIGH
D: GPIO22 is HIGH
D: GPIO23 is HIGH
D: GPIO25 is HIGH
D: GPIO26 is HIGH
D: GPIO27 is HIGH
D: GPIO32 is HIGH
D: GPIO33 is HIGH
D: GPIO34 is HIGH
D: GPIO35 is HIGH
D: GPIO39 is HIGH
D: gpio_00 will execute upvolume= 3
D: gpio_12 will execute mute
D: gpio_13 will execute uppreset= 1
D: gpio_34 will execute downpreset = 1
D: gpio_39 will execute downvolume= 3
D: Enable pin 35 for IR
D: Start OLED display
D: Init OLED 1306, I2C pins 21,22
I2C buf is 128
D: Create list with acceptable WiFi networks
D: Added DATALAN-PRO-2.4G to list of networks
D: Added DATALAN to list of networks
D: Scan Networks
D: Scan completed
D: Number of available networks: 5
D:  1 - DATALAN                   Signal: -53 dBm, Encryption WPA_WPA2_PSK, Acceptable
D:  2 - audiolan                  Signal: -73 dBm, Encryption  WEP,
D:  3 - DATALAN-PRO-2.4G          Signal: -75 dBm, Encryption WPA2_PSK, Acceptable
D:  4 - Mechler Office Gast       Signal: -86 dBm, Encryption WPA2_PSK,
D:  5 - HomeME                    Signal: -89 dBm, Encryption WPA2_PSK,
D: End of list
D: updateNr 0 <= 0 to 2, relative is 0
D: updateNr result is 0
D: nextPreset is 0
D: Starting I2S playtask..
D: Output to I2S, pins 5, 32 and 4
D: Connect to network
D: SSID = DATALAN
D: IP = 192.168.0.151
D: Start web server
D: Network found. Starting mp3 client, mqtt and OTA
D: MQTT uses prefix radio1
D: Init MQTT
D: MDNS responder started
D: Rotary encoder is enabled
D: Sync TOD
D: Sync TOD, new value is 15:59:10
D: updateNr 0 <= 8 to 2, relative is 0
D: updateNr result is 2
D: nextPreset is 2
D: Radiofuncs cmd is 1
D: Connect to host di
D: Connect to host di
D: send GET command
D: Switch to HEADER
D: Headerline: Content-Length: 0
D: Headerline: Connection: close
D: Headerline: Access-Control-Allow-Methods: GET, OPTIONS, HEAD
D: Headerline: Access-Control-Allow-Origin: *
D: Headerline: Cache-Control: no-cache, no-store
D: Headerline: Location: http://d141.rndfnk.com/ard/br/br3/live/mp3/128/stream.mp3?cid=01FBPVFWX7C216W6WY4M4M7MF7&sid=2fBYUMHQvVublnNx1yeO4XisNCB&token=ilLL3IPytqEnEVxrjphQbaFlaybkvzWaeHzdPUQ4gEc&tvf=xr
D: Redirect
D: (Re)connecting number 1 to MQTT 192.168.0.2
D: Radiofuncs cmd is 1
D: Connect to host d141.rndfnk.com/ard/br/br3/live/mp3/128/stream.mp3?cid=01FBPVFWX7C216W6WY4M4M7MF7&sid=2fBYUMHQvVublnNx1yeO4XisNCB&token=ilLL3IPytqEnEVxrjphQbaFlaybkvzWaeHzdPUQ4gEc&tvf=xrztAQzbxhdkMTQ
D: send GET command
D: Switch to HEADER
D: Headerline: Content-Type: audio/mpeg
D: Headerline: icy-metaint: 16384
D: Headerline: icy-br: 128
D: Headerline: ipic radio1/ip : 192.168.0.151␀;ice-channels=2;ice-samplerate=48000
D: Headerline: icy-description:
D: Headerline: icy-genre:
D: Headerline: icy-name: BAYERN 3
D: Headerline: icy-pub: 0
D: Headerline: icy-samplerate: 44100
D: Headerline: icy-url: 
D: Headerline: Server: rocketstreamingserver
D: Headerline: Cache-Control: max-age=0, no-cache, no-store
D: Headerline: Pragma: no-cache
D: Headerline: Expires: Tue, 16 Apr 2024 13:59:13 GMT
D: Headerline: Accept-Ranges: none
D: Headerline: Access-Control-Allow-Origin: *
D: Headerline: Access-Control-Expose-Headers: Content-Type, icy-metaint, icy-br, ice-audio-info, icy-description, icy-genre, icy-name, icy-samplerate, icy-url
D: Headerline: Connection: Close
D: Switch to DATA, bitrate is 128, metaint is 16384
D: Switch to DATA, bitrate is 128, metaint is 16384
D: Playtask start song
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Playtask stop song
D: Publish to topic radio1/icy/name : BAYERN 3
D: Publish to topic radio1/preset : 2
D: Publish to topic radio1/playing : 0
D: Sync found at 0x00E0
D: MP3Decode error -2
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Sync found at 0x00E0
D: MP3Decode error -6
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Sync found at 0x0020
D: MP3Decode error -2
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Sync found at 0x0140
D: Bitrate     is 128000
D: Samprate    is 48000
D: Channels    is 2
D: Bitpersamp  is 16
D: Outputsamps is 2304
D: Streamtitle found, 37 bytes
D: StreamTitle='Jason Derulo: Acapulco';
D: Publish to topic radio1/icy/streamtitle : Jason Derulo: Acapulco
D: Publish to topic radio1/volume : 10
D: updateNr 2 <= 8 to -1, relative is 1
D: updateNr result is 1
D: nextPreset is 1
D: Radiofuncs cmd is 1
D: Stopping client
D: Playtask stop song
D: Connect to host liveradio.swr.de/sw282p3/swr3/play.mp3
D: send GET command
D: Publish to topic radio1/preset : 1
D: Switch to HEADER
D: Headerline: access-control-allow-origin: *
D: Headerline: access-control-allow-methods: GET, OPTIONS, HEAD
D: Headerline: access-control-allow-headers: Accept, Origin, X-Requested-With, Content-Type
D: Headerline: swr-region: europe-west3
D: Headerline: swr-service: swr-streamplay
D: Headerline: swr-stage: prod
D: Headerline: swr-trace: 3b880855be2fe81fc47c4f32e5ff2bb0/10480003042947322288
D: Headerline: swr-version: 1.7.1
D: Headerline: location: http://dispatcher.rndfnk.com/swr/swr3/live/mp3/128/stream.mp3?aggregator=web
D: Headerline: X-Cloud-Trace-Context: 3b880855be2fe81fc47c4f32e5ff2bb0
D: Headerline: Server: Google Frontend
D: Headerline: Content-Length: 98
D: Headerline: Cache-Control: public, s-maxage=21600, max-age=300
D: Headerline: Content-Type: text/plain; charset=utf-8
D: Headerline: swr-cache-status: hit
D: Headerline: swr-cache-id: MUC-3ec5f666
D: Redirect
D: Switch to HEADER
D: Publish to topic radio1/playing : 0
D: Radiofuncs cmd is 1
D: Connect to host dispatcher.rndfnk.com/swr/swr3/live/mp3/128/stream.mp3?aggregator=web
D: Playtask stop song
D: send GET command
D: Publish to topic radio1/preset : 1
D: Switch to HEADER
D: Headerline: Content-Length: 0
D: Headerline: Connection: close
D: Headerline: Access-Control-Allow-Methods: GET, OPTIONS, HEAD
D: Headerline: Access-Control-Allow-Origin: *
D: Headerline: Cache-Control: no-cache, no-store
D: Headerline: Location: http://d111.rndfnk.com/ard/swr/swr3/live/mp3/128/stream.mp3?aggregator=web&cid=01FC1X5J7PN2N3YQPZYT8YDM9M&sid=2fBYYXaVEzeQeSBfTJUuJ82EFDs&token=rCXP80nilgOU3wYvEvMYoYtwYbvxR-6BM
D: Redirect
D: Publish to topic radio1/playing : 0
D: Radiofuncs cmd is 1
D: Connect to host d111.rndfnk.com/ard/swr/swr3/live/mp3/128/stream.mp3?aggregator=web&cid=01FC1X5J7PN2N3YQPZYT8YDM9M&sid=2fBYYXaVEzeQeSBfTJUuJ82EFDs&token=rCXP80nilgOU3wYvEvMYoYtwYbvxR-6BMmn777sLRH8&tv
D: send GET command
D: Publish to topic radio1/preset : 1
D: Switch to HEADER
D: Headerline: Content-Type: audio/mpeg
D: Headerline: icy-metaint: 16384
D: Headerline: icy-br: 128
D: Headerline: ice-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2
D: Headerline: icy-description: SWR3
D: Headerline: icy-genre: Pop Music
D: Headerline: icy-name: SWR3 MP3 128
D: Headerline: icy-pub: 0
D: Headerline: icy-samplerate: 48000
D: Headerline: icy-url: https://www.swr3.de/
D: Headerline: Server: rocketstreamingserver
D: Headerline: Cache-Control: max-age SWR3 MP3 128␀no-store
D: Headerline: Pragma: no-cache
D: Headerline: Expires: Tue, 16 Apr 2024 13:59:46 GMT
D: Headerline: Accept-Ranges: none
D: Headerline: Access-Control-Allow-Origin: *
D: Headerline: Access-Control-Expose-Headers: Content-Type, icy-metaint, icy-br, ice-audio-info, icy-description, icy-genre, icy-name, icy-samplerate, icy-url
D: Headerline: Connection: Close
D: Switch to DATA, bitrate is 128, metaint is 16384
D: Switch to DATA, bitrate is 128, metaint is 16384
D: Playtask start song
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Playtask stop song
D: Publish to topic radio1/playing : 0
D: Streamtitle found, 59 bytes
D: StreamTitle=' *** Werbung in SWR3 *** Werbung in SWR3 ***';
D: Publish to topic radio1/icy/streamtitle :  *** Werbung in SWR3 *** Werbung in SWR3 ***
D: Sync found at 0x00EB
D: MP3Decode error -6
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Sync found at 0x0020
D: Bitrate     is 128000
D: Samprate    is 48000
D: Channels    is 2
D: Bitpersamp  is 16
D: Outputsamps is 2304
D: MP3Decode error -6
D: helixInit called for audio/mpeg, e is 255, d is 255
D: Sync found at 0x0120
D: Bitrate     is 128000
D: Samprate    is 48000
D: Channels    is 2
D: Bitpersamp  is 16
D: Outputsamps is 2304
D: Streamtitle found, 69 bytes
D: StreamTitle='SWR3 Nachrichten - auch zum Nachhören in der SWR3 App';
D: Publish to topic radio1/icy/streamtitle : SWR3 Nachrichten - auch zum Nachhören in der SWR3 App
D: updateNr 1 <= 8 to 7, relative is 0
D: updateNr result is 7
D: nextPreset is 7
D: Radiofuncs cmd is 1
D: Stopping client
D: Playtask stop song
D: Connect to host dispatcher.rndfnk.com/swr/swr1/rp/mp3/128/stream.mp3
D: Publish to topic radio1/preset : 7
D: Publish to topic radio1/playing : 0
D: Stack maintask  is 6200
D: Stack playtask  is 992
D: ADC reading is 765
D: 36 IR interrupts seen
Edzelf commented 2 months ago

The FIXEDWIFI is just an (extra) entry in the list of WiFi networks. Handy if the configured list is still empty.

I cannot reproduce the error. Maybe because I have a different hardware set-up. I also see that you are not running the latest version....

thb584Git commented 2 months ago

Thanx for comments and spending your time. Well, the only version reference in logs I see is in my second post (Version Sun, 15 May 2022) the old release-version. Can't find one in the first post for lastet built (downloaded curent state from github). However both builts work in priciple but have the same issue with my HW regarding audio stopping on preset change. The WIFI predefinition works with the old built and is no problem anyway.
Might be a problem with I2S-DAC. But stream information is not available anymore, station diplayed is the one before the failing change. Volume bar is updated when changing volume, time is updated as well, rotary encoder is working for volume, selecting station but change also not working. Do you have a HW setup using I2S or do you know people using such setup? Would help to know if this is a general problem or related to my design e.g. GPIO's used. The problem is fully reproducable. I can switch stations as long as the interval is short. Testing 10,20,30,60 and 90s worked, 120s failed. Reboot and waiting for 120s immediatly failed as well. So not related to prehistory or number of changes. Hard to imagine this is HW-related but never say never. How to track down?

Edzelf commented 2 months ago

Please, try the 06-MAR-2024 first.

thb584Git commented 2 months ago

Hm, probably my bad. I see one release (5.5.22) and 5 tagged versions also latest 5.5.22 and the current project state. How to try 06-MAR-2024? Downloading zip of current project was what I did before (first post no version number in log file) However if it's that what you mean I will give it another try in a clean environment. Maybe something went wrong.

Edzelf commented 2 months ago

Do not use the archive, download from the code page. The version is at line 111 of main.cpp.

thb584Git commented 2 months ago

After long testing some more information and takeaway from it.

I set up a new directory unzipped downloaded head of main, edited platformio.ini and config.h.

Erased flash, did a build, build filesystem image, uploaded build. uploaded filesystem image.

I did this many times, since Igot differing behavior regarding preferences displayed in web interface after first boot, version shown or not in serial interface, GPIO00 toggling for whatever reason - made me feel like an idiot.

Sometime this made me have a look at the platform version and this was quite strange, I have for legacy reason various installed Espressif 32 3.5/4.4,/6.0/6.0.1 and some Espressif 32 (2023.6.4). For whatever reason not the latest was used but this strange Espressif 32 (2023.6.4), I have no glue where is came from.

After fixing this in platform.ini to Espressif 6.0.1, a lot of update was starting for the project and things got better.

If have still seen the problem when audio stream stops, interface is still responding and reboot is needed for audio again. I saw immediate reboot on channel switching. But this happens a lot less often and randomly. Not perfect but hopefully acceptable WAF (women's acceptance factor).

I tested finally without any HW attached to the NodeMCU 32S. A least in my configuration audio stream can be checked by test function in Web interface. Missing display , rotary encoder and push button are no problem using web interface as well. So if this is related to my I2S-DAC/OLED1306 setup you should be able to test this on your side without such HW.

I attached a serial log showing boot, working and failing preselect. This was a bad sequence. Currently it is running for more than a hour changing the preselect successfully several times.

What version of Espressif 32 platform do you use? I might give it a try with it.

Sometimes it doesn't come easy even after 30 years of HW/FW development🙁

Thankyou for your effort and this great project. ESP32_Radio_024-04-18 13-39-15-511.txt

Edzelf commented 2 months ago

I have made a set-up like yours with a PCM5102 module. I still cannot reproduce the bug, but I will leave the radio on for a few days. However there may be a problem with closing the stream when changing station. The function stop_mp3client in main.cpp should be changed like this:

void stop_mp3client ()
{
  queueToPt ( QSTOPSONG ) ;                        // Queue a request to stop the song
  while ( mp3client && mp3client->connected() )    // Client active and connected?
  {
    ESP_LOGI ( TAG, "Stopping client" ) ;          // Yes, stop connection to host
    mp3client->close() ;                           // Close connection
    mp3client->abort() ;                           // Necesary to prevent crash
    vTaskDelay ( 500 / portTICK_PERIOD_MS ) ;
  }
}

This has been corrected in the latest version.

thb584Git commented 2 months ago

Thank you for investigating, even not able to reproduce it. Well on normal use I saw two reboots the last days, both pretty soon after starting the radio tuning the station. Still have no glue, I think the platform version is not the reason. The second device was in a state I had continous reboots not working at all. Persisting bahaviour after serveral times of compiling and fashing. Got back to work again after using your Arduino .ino code programming the prederences. Might there be some inizialising missing causing random data accessed? However erase before upload as I apply should provide the same content. I don't see the modified version on githb , I will patch the code and give it a try. Thanks