Open thb584Git opened 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:
WLAN AP in config.h was recocknized
dubug gives much more information (was defined 0 that time)
build_flags =
-DCORE_DEBUG_LEVEL=0
-Os
; -Wl,-Map,ESP32-Radio.map
but audio play issue exist here as well, same behavior
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
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....
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?
Please, try the 06-MAR-2024 first.
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.
Do not use the archive, download from the code page. The version is at line 111 of main.cpp.
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
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.
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
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:
platformio.ini:
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.