ESP32Radio-V2
ESP32Radio-V2 copied to clipboard
Problems Configuring SPDIF Output
Hey,
I really like this project! Great work! I'd love to build it myself, but I'm having trouble getting the SPDIF output to work. Here's my config from the web interface:
Daylight saving time offset: 1 hour
UTC offset: 1 hour
Time server: pool.ntp.org
GPIO settings:
gpio_00: upper preset (set to 1)
gpio_14: stop
gpio_17: resume
gpio_34: station (set to icecast.omroep.nl:80/radio1-bb-mp3)
Rotary encoder pins:
CLK: 25
DT: 26
SW: 27
SPDIF pin: 2
Presets:
Preset 00: http://icecast.ndr.de/ndr/njoy/live/mp3/128/stream.mp3 (N-Joy)
Tone settings: all set to 0
Volume: 100
Wi-Fi settings:
Wi-Fi 00: /***
Wi-Fi 01: SSID2/PASSWD2
Also, I'm wondering if it's possible to ditch the rotary encoder and just rely on buttons for control.
Thanks in advance, and sorry for my improvised English.
Are you sure you have defined "pin_i2s_spdif" in the config page of the web interface? If you remove the definitions of "pin_enc_clk", "pin_enc_clk" and "pin_enc_clk" from the config page in the web interface, the rotary encoder is not activated. The LED in the SPDIF transmitter should light up. You can make a simple "blink" program using the pin connected to the SPDIF transmitter to test it. Alway show the serial debug output, so we can help to find the problem.
Is there a tutorial on how to use the Spdif support? My web interface configs look like this right now and i dont get any sound: ($)pin_i2s_bck = 5 # GPIO Pin number for I2S "BCK" ($)pin_i2s_din = 34 # GPIO Pin number for I2S "DIN" ($)pin_i2s_lck = 32 # GPIO Pin number for I2S "L(R)CK"
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 = uppreset = 1 gpio_12 = upvolume = 2 gpio_13 = downvolume = 2 gpio_14 = stop gpio_17 = resume gpio_34 = station = icecast.omroep.nl:80/radio1-bb-mp3
mqttbroker = none mqttpasswd = none mqttport = 1883 mqttprefix = none mqttuser = none
pin_i2s_spdif = 5 pin_ir = 35 # GPIO Pin number for IR receiver VS1838B pin_tft_cs = 15 # GPIO Pin number for TFT "CS" pin_tft_dc = 2 # GPIO Pin number for TFT "DC"
preset = 1 preset_00 = 109.206.96.34:8100 # 0 - NAXI LOVE RADIO, Belgrade, Serbia preset_01 = airspectrum.cdnstream1.com:8114/1648_128 # 1 - Easy Hits Florida 128k preset_02 = stream.hitfm.de:9050/live # 2 - 89 HIT FM - Munichs Power Station, 128k preset_03 = airspectrum.cdnstream1.com:8000/1261_192 # 3 - Magic Oldies Florida preset_04 = airspectrum.cdnstream1.com:8008/1604_128 # 4 - Magic 60s Florida 60s Classic Rock preset_05 = us1.internet-radio.com:8105 # 5 - Classic Rock Florida - SHE Radio preset_06 = icecast.omroep.nl:80/radio1-bb-mp3 # 6 - Radio 1, NL, 192k preset_07 = 205.164.62.15:10032 # 7 - 1.FM - GAIA, 64k preset_08 = www.doowopradio.com:8000 # 8 - Doo-Wop Radio, 96k preset_09 = server-27.stream-server.nl:8192/stream # 9 - 192 Radio Nederland, 320k
toneha = 0 tonehf = 0 tonela = 0 tonelf = 0
volume = 100
wifi_00 = / wifi_01 = SSID2/PASSWD2
Maybe I am just making a dumb mistake, but I am very confused at the moment.
Read this. See chapter 1.3.
Hi, I also haven't been able to get the SPDIF output to work, I've followed the guide to the letter. Please help
webconfig:
($)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_sd_cs = 21 # GPIO Pin number for SD card CS
($)pin_tft_dc = 2 # GPIO Pin number for TFT DC
($)pin_vs_cs = 5 # GPIO Pin number for VS1053 CS
($)pin_vs_dcs = 16 # GPIO Pin number for VS1053 DCS
($)pin_vs_dreq = 4 # GPIO Pin number for VS1053 DREQ
#
clk_dst = 1
clk_offset = 1
clk_server = pool.ntp.org
#
gpio_00 = uppreset = 1
gpio_12 = upvolume = 2
gpio_13 = downvolume = 2
#
ir_40BF = upvolume = 2
ir_C03F = downvolume = 2
#
mqttbroker = none
mqttpasswd = none
mqttport = 1883
mqttprefix = none
mqttuser = none
#
pin_i2s_spdif = 15
#
preset = 0
preset_00 = relay.181.fm:8074 # 0 - vibe of vegas
preset_01 = airspectrum.cdnstream1.com:8114/1648_128 # 1 - Easy Hits Florida 128k
preset_02 = us2.internet-radio.com:8050 # 2 - CLASSIC ROCK MIA WWW.SHERADIO.COM
preset_03 = airspectrum.cdnstream1.com:8000/1261_192 # 3 - Magic Oldies Florida
preset_04 = airspectrum.cdnstream1.com:8008/1604_128 # 4 - Magic 60s Florida 60s Classic Rock
preset_05 = us1.internet-radio.com:8105 # 5 - Classic Rock Florida - SHE Radio
preset_06 = icecast.omroep.nl:80/radio1-bb-mp3 # 6 - Radio 1, NL
preset_07 = 205.164.62.15:10032 # 7 - 1.FM - GAIA, 64k
preset_08 = skonto.ls.lv:8002/mp3 # 8 - Skonto 128k
preset_09 = 94.23.66.155:8106 # 9 - *ILR CHILL and GROOVE
preset_10 = ihr/IHR_IEDM # 10 - iHeartRadio IHR_IEDM
preset_11 = ihr/IHR_TRAN # 11 - iHeartRadio IHR_TRAN
preset_12 = 109.206.96.34:8100 # 12 - NAXI LOVE RADIO, Belgrade, Serbia
#
toneha = 0
tonehf = 0
tonela = 0
tonelf = 0
#
volume = 72
#
wifi_00 = ElPapuPro/******
config.h
//***************************************************************************************************
// config.h *
//***************************************************************************************************
// Configuration definition for your particular set-up. *
//***************************************************************************************************
//
#ifndef CONFIG_H
//#define NAME "ESP32-Radio" // Define name of the radio, also AP SSID,
// also namespace in NVS.
// Default is "ESP32-Radio"
//#define SDCARD // Experimental: For SD card support (reading MP3-files)
//#define ETHERNET // For wired Ethernet (WT32-ETH-01 or similar)
#define FIXEDWIFI "ElPapuPro/*******" // Add a fixed SSID to the list (WiFi only)
//#define ENABLEOTA // OTA feature
// Define (just one) type of MP3/AAC decoder
//#define DEC_VS1053 // Hardware decoder for MP3, AAC, OGG
//#define DEC_VS1003 // Hardware decoder for MP3 only
//#define DEC_HELIX // Software decoder for MP3, AAC. I2S output
#define DEC_HELIX_SPDIF // Toslink/Spdif output for MP3, AAC (experimental)
//#define DEC_HELIX_AI // Software decoder for AI Audio kit (AC101)
//#define DEC_HELIX_INT // Software decoder for MP3, AAC. DAC output
// Needs platform = [email protected] !!!!
// Define (just one) type of display. See documentation.
//#define BLUETFT // Works also for RED TFT 128x160
//#define ST7789 // 240x240 TFT (SPI)
//#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
//
// Define ZIPPYB5 if a ZIPPY B5 Side Switch is used instead of a rotary switch
//#define ZIPPYB5
// End of configuration parameters.
#define CONFIG_H
#endif
serial output:
[ 9328][V][WiFiGeneric.cpp:384] _arduino_event_cb(): SCAN Done: ID: 128, Status: 0, Results: 8
[ 9337][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 1 - SCAN_DONE
[ 9345][I][WiFiMulti.cpp:114] run(): [WIFI] scan done
[ 9350][I][WiFiMulti.cpp:119] run(): [WIFI] 8 networks found
[ 9356][D][WiFiMulti.cpp:149] run(): ---> 0: [6][74:4D:28:E4:2A:7B] ElPapuPro (-35) *
[ 9364][D][WiFiMulti.cpp:149] run(): ---> 1: [6][74:4D:28:E4:26:D7] ElPapuPro (-69) *
[ 9372][D][WiFiMulti.cpp:149] run(): ---> 2: [6][74:4D:28:E4:2A:25] ElPapuPro (-76) *
[ 9380][D][WiFiMulti.cpp:149] run(): ---> 3: [6][74:4D:28:E4:26:FE] ElPapuPro (-77) *
[ 9389][D][WiFiMulti.cpp:151] run(): 4: [3][40:3F:8C:96:DD:02] TP-Link_AP_DD02 (-83) *
[ 9397][D][WiFiMulti.cpp:151] run(): 5: [1][A4:39:B3:89:27:62] sc-cef0_Plus (-85) *
[ 9406][D][WiFiMulti.cpp:151] run(): 6: [5][DC:9F:DB:AC:1F:8D] RED-KUKA (-85) *
[ 9414][D][WiFiMulti.cpp:151] run(): 7: [11][E4:BF:FA:D7:79:99] FRANCISCO-2.4GHZ (-86) *
[ 9423][I][WiFiMulti.cpp:160] run(): [WIFI] Connecting BSSID: 74:4D:28:E4:2A:7B SSID: ElPapuPro Channel: 6 (-35)
[ 9434][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
[ 9693][V][WiFiGeneric.cpp:356] _arduino_event_cb(): STA Connected: SSID: ElPapuPro, BSSID: 74:4d:28:e4:2a:7b, Channel: 6, Auth: WPA2_PSK
[ 9706][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
[ 10255][V][WiFiGeneric.cpp:370] _arduino_event_cb(): STA Got New IP:192.168.3.91
[ 10263][D][WiFiGeneric.cpp:1040] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
[ 10270][D][WiFiGeneric.cpp:1103] _eventCallback(): STA IP: 192.168.3.91, MASK: 255.255.255.0, GW: 192.168.3.1
[ 10280][I][WiFiMulti.cpp:174] run(): [WIFI] Connecting done.
[ 10286][D][WiFiMulti.cpp:175] run(): [WIFI] SSID: ElPapuPro
[ 10291][D][WiFiMulti.cpp:176] run(): [WIFI] IP: 192.168.3.91
[ 10297][D][WiFiMulti.cpp:177] run(): [WIFI] MAC: 74:4D:28:E4:2A:7B
[ 10303][D][WiFiMulti.cpp:178] run(): [WIFI] Channel: 6
[ 10309][I][main.cpp:1569] connectwifi(): [main] SSID = ElPapuPro
[ 10315][I][main.cpp:1573] connectwifi(): [main] IP = 192.168.3.91
[ 10321][I][main.cpp:2590] setup(): [main] Start web server
[ 10328][I][main.cpp:2601] setup(): [main] Network found. Starting clients
[ 10341][I][main.cpp:2635] setup(): [main] MDNS responder started
[ 11350][I][main.cpp:2680] setup(): [main] Rotary encoder is disabled (-1/-1/-1)
[ 11357][I][main.cpp:4251] gettime(): [main] Sync TOD
[ 14713][I][main.cpp:4264] gettime(): [main] TOD synced
[ 14718][I][main.cpp:4406] playtask(): [main] Starting I2S playtask..
[ 14728][I][main.cpp:4439] playtask(): [main] Output to SPDIF, pin 15
[ 14820][I][main.cpp:895] nextPreset(): [main] nextPreset is 0
[ 14827][I][main.cpp:3285] radiofuncs(): [main] Radiofuncs cmd is 1
[ 14833][I][main.cpp:4482] playtask(): [main] Playtask stop song
[ 14835][I][main.cpp:1330] connecttohost(): [main] Connect to host relay.181.fm:8074
[ 15018][I][main.cpp:2406] onConnect(): [main] Connected to host at 216.235.80.84 on port 8074
[ 15050][I][main.cpp:1391] connecttohost(): [main] send GET command
[ 15058][I][helixfuncs.h:85] player_setVolume(): [helixfuncs] Volume set to 72
[ 15674][I][main.cpp:3534] handlebyte_ch(): [main] Switch to HEADER
[ 15681][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: X-Loudness: -10.706655
[ 15689][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-description: 181.FM The Vibe of Vegas
[ 15698][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-pub: 1
[ 15705][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2
[ 15717][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-url: http:/181.fm
[ 15725][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-name: 181.FM The Vibe of Vegas
[ 15734][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Content-Type: audio/mpeg
[ 15742][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-metaint: 16000
[ 15749][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-genre: Easy Listening
[ 15757][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Instance-id: b4d017bb3d2a776a26ae2b10da8dc0cc
[ 15767][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Server: Streaming Server 9.0.7
[ 15776][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: icy-br: 128
[ 15783][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Expires: Mon, 26 Jul 1997 05:00:00 GMT
[ 15792][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Pragma: no-cache
[ 15799][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Cache-Control: no-cache
[ 15807][I][main.cpp:3555] handlebyte_ch(): [main] Headerline: Connection: close
[ 15814][I][main.cpp:3625] handlebyte_ch(): [main] Switch to DATA, bitrate is 128 kbps, metaint is 16000
[ 15824][I][main.cpp:4474] playtask(): [main] Playtask start song
[ 15830][I][helixfuncs.h:114] helixInit(): [helixfuncs] helixInit called for audio/mpeg
[ 15915][I][helixfuncs.h:233] playChunk(): [helixfuncs] Sync found at 0x0000
[ 15938][I][helixfuncs.h:286] playChunk(): [helixfuncs] Bitrate is 128000
[ 15945][I][helixfuncs.h:287] playChunk(): [helixfuncs] Samprate is 44100
[ 15952][I][helixfuncs.h:288] playChunk(): [helixfuncs] Channels is 2
[ 15959][I][helixfuncs.h:289] playChunk(): [helixfuncs] Bitpersamp is 16
[ 15966][I][helixfuncs.h:290] playChunk(): [helixfuncs] Outputsamps is 2304
[ 16554][I][main.cpp:1224] showstreamtitle(): [main] Streamtitle found, 53 bytes
[ 16561][I][main.cpp:1225] showstreamtitle(): [main] StreamTitle='Dynoro & Gigi D'Agostino - In My Mind ';
[ 18389][W][AsyncTCP.cpp:950] _poll(): rx timeout 4
[ 18913][W][AsyncTCP.cpp:950] _poll(): rx timeout 4
[ 19451][W][AsyncTCP.cpp:950] _poll(): rx timeout 4
[ 20526][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
Try to make a "blink" program for GPIO 15 and check if the red LED in the led is blinking.
thank you for responding. https://github.com/Edzelf/ESP32Radio-V2/assets/17991421/a24ab747-9fcf-4993-8e8c-ee110d74e232
I also have no issue using a blink sketch on gpio 15. I have same config.h as shown by other user above (except wifi credentials). I also have no audio from SPDIF. However, using this example from another library: https://github.com/pschatzmann/arduino-audio-tools/tree/main/examples/examples-communication/a2dp/streams-a2dp-spdif
(simply changing proper pin to 15 for the ESP32-Radio hardware boards I got from PCBWay -- it does work.
So hardware isn't wrong and pin 15 is functioning properly.
Any solution yet?
I was able to reproduce the bug. I am working on it.... Found the bug. The modified files (main.cpp and helixfunc.h) are now in the repositry.