ESP32Radio-V2
ESP32Radio-V2 copied to clipboard
Wired Ethernet support?
not an issue :-)
Hello,
is it planned to add wired ethernet support for this great work?
Actually, there are some modified variants of your software with support for e.g. LAN8720. The only difference for the software part is that the SPI bus for the lcd and sd card has to be moved to the second hardware SPI bus (called HSPI) because the RMII pins are needed for the LAN chip. In consequence, some pins have to be switched but this should not be a problem because of the GPIO definition in the NVS text file.
An ethernet connection is for most users with an automation systems the best choice. The RMII interface of the ESP32 supports wired ethernet out-of-the-box.
Here is an example schematic showing the new pin definitions - VS1053, Ethernet via RMII and LCD are possible at the same time:
I guess the radio will work well on a WT32-ETH-01 board. The Ethernet interface will use som GPIO pins, so maybe some features must be eliminated.
Hi Ed,
it would be great if there would be a possibility in your code to switch to HSPI pins for the SPI bus. Only renaming the pins does not work because the standard SPI bus is VSPI and i am not good enough in software to get that solved (as what i learned, a new SPI class has to be defined for VSPI).
With this modification there would be a maximum flexibility for other hardware parts. It would be great if you have a look on it.
Thanks, Stefan
i guess you could use any vspi or hspi pin by just changing the pin in config. if that is not working then you can just create adruino SPIClass SPI2(pin, pin, pin, speed) and replace the existing SPI to SPI2 you just created before the SPI begin function.
is very simple 2 line of codes. give it a try.
hi @dreamy1, can you point or share the url for the other variant or fork of the internet radio that was using the lan module?
Hi @tsctrl,
the radio with LAN is here: https://sites.google.com/site/pcusbprojects/5-custom-projects/er-secure-esp32-internet-radio-with-wired-ethernet-connection
It is a modified version of the V1 of the radio from Ed. There is also a modification for using HSPI, but this doesn't compile (it seems that the SPI.h of the ESP32 was changed in the meantime by Arduino IDE). I tried to get it work with some code you posted above (new SPI Class), but with no success.
Regards, Stefan
Did you have a look on it @tsctrl ?
just dont use the arduino ide. use at least platform io. i doubt you couldnt change the spi pin. SPI class is predefined in the lib and you should able to use the VSPI pin with that predefine SPI class. in fact i just use VSPI pin using the SPI class and codes that was created by Ed and it works.
if that was not work either. the worst case is you have to modify the esp32 arduino library. but i dont think you have to do this.
here is the example you can follow: https://github.com/espressif/arduino-esp32/blob/master/libraries/SPI/examples/SPI_Multiple_Buses/SPI_Multiple_Buses.ino
Thanks for the input - i tried that already but it seems that there is a bit more than a declaration at the entry of the code because the whole spi commands must contain a "hspi" and the whole declaration of the VS1053 is based on VSPI.
And i am worse at software...but good in hardware :-)
Here https://github.com/schreibfaul1/ESP32-vs1053_ext/blob/master/src/vs1053_ext.cpp#L146 a simple solution seems to be implemented without any change on the ESP32 SPI library. It works out of the box with my hardware.
But i am not able to adapt it to this version of the radio. So any help is really appreciated :-)
you need to have this declaration and have all your code to use this SPI Class to handle the SPI bus data transfer instead of Predefined SPI Class. And you have to point the initialization to that Class.
https://github.com/schreibfaul1/ESP32-vs1053_ext/blob/0014147924b574987d11e730cfa50d315d9edf73/src/vs1053_ext.h#L153
for Ed implementation is more simpler and use the SPI Class declared in the library that use VSPI by default. https://github.com/espressif/arduino-esp32/blob/6cfe4613e4b4846e1ab08c7f78b7ea241f52c7da/libraries/SPI/src/SPI.h#L56
so, to change is by:
- create new SPIClass spi2 with HSPI/VSPI.
- change all SPI text to spi2. such as SPI.beginTransfer to spi2.beginTransfer
basically if you use the same code you share it should work.
Thanks, i tried exactly what you suggested. But i got a lot of errors while compiling, all related to SPI. Maybe the place of the declaration was wrong and it seems that there are other dependencies to https://github.com/Edzelf/ESP32Radio-V2/blob/main/lib/codecs/src/VS1053.cpp
Next week I hope to get a WT32-ETH-01 board. And I will see if I an run the radio software on it.
Thanks a lot Ed, that would be great to get it to work!
Stefan
Hi Ed,
did you get your WT32-ETH-01 board?
Regards, Stefan
Yes, just one hour ago.
Great :-)
If you need any help regarding the hardware, please let me know. The WT32-S1 seems to be a low-cost variant of the common ESP32...i can't find any info about RAM and if it is a dual core cpu.
Maybe here are some useful info about the WT32-ETH01: https://github.com/khoih-prog/WebServer_WT32_ETH01
WT32-ETH01 is supported now, define ETHERNET in config.h. Pin usage for Ethernet controller WT32-ETH01:
"pin_eth_mdc" 23
"pin_eth_mdio" 18
"pin_eth_power" 16
"????" 00
Boah....Ed, you're absolutely great! I am really very impressed that you are able to present a solution so quick :-)
I will try it - just two questions:
- Is it possible to not use "pin_eth_power"? This is because in my application the activation of the LAN8720 is controlled externally.
- Does SPI now still use hardware HSPI? Or is this still VSPI with routed signals by the GPIOMUX of the ESP32?
BTW: please let me know how i can estimade and support your great work by a paypal donation or you can get one of my hardware solution for this radio for free...i will take some pictures when it is running final :-)
Yes, you may set the 3 pin definitions in the config page of the webinterface, or change the defaults in the source of main.cpp. The software is still using the same SPI bus. I did not test it yet, just connected a I2S module to a bare WT32-ETH01. Surely I'm interested in your hardware solution.
Just battling with compilation errors...i added the lib ESPAsyncWebServer from here: https://github.com/me-no-dev/ESPAsyncWebServer
But it seems to be not the correct one:
C:\Users\Stefan\Documents\Arduino\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:33:10: fatal error: AsyncTCP.h: No such file or directory #include <AsyncTCP.h> ^~~~~~~~~~~~ compilation terminated.
Problem solved, it was the AsyncTCP-master library missing.
Unfortunately, a lot of new compilation errors comes with ST7789 defined in config.h, e.g.:
C:\Users\Stefan\Desktop\ESP Radio\ESP32_Edzelf\ESP32Radio\ESP32Radio.ino: In function 'void tftset(uint16_t, const char*)': ESP32Radio:848: error: 'TFTSECS' was not declared in this scope if ( inx < TFTSECS ) // Segment available on display ^~~~~~~ ESP32Radio:852: error: 'tftdata' was not declared in this scope tftdata[inx].str = String ( str ) ; // Yes, set string
...and much more regarding the tft declarations.
Show your config.h. You probably have no display configured.
This is my config.h, the adafruit libs are installed too:
//*************************************************************************************************** // 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 ETHERNET //#define FIXEDWIFI "MYWIFI/password" // 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
// 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
//bat0 = 2178 # ADC for 0% battery capacity left //bat100 = 3256 # ACD for 100% battery capacity
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 //mqttuser = carol
//pin_enc_clk = 25 # GPIO rotary encoder CLK //pin_enc_dt = 26 # GPIO rotary encoder DT //pin_enc_sw = 27 # GPIO rotary encoder SW pin_spi_sck = 14 pin_spi_miso = 12 pin_spi_mosi = 13 pin_ir = 39 # GPIO IR receiver VS1838B pin_tft_bl = 2 pin_tft_cs = 4 # GPIO TFT CS pin_tft_dc = 5 # GPIO TFT DC pin_vs_cs = 15 # GPIO VS1053 CS pin_vs_dcs = 32 # GPIO VS1053 DCS pin_vs_dreq = 33 # GPIO VS1053 DREQ
preset = 8 preset_000 = 109.206.96.34:8100 # 0 - NAXI LOVE RADIO, Belgrade, Serbia preset_001 = airspectrum.cdnstream1.com:8114/1648_128 # 1 - Easy Hits Florida preset_002 = streamer.radio.co/sa7bf61271/listen # 2 - JB's Rock N Roll preset_003 = airspectrum.cdnstream1.com:8000/1261_192 # 3 - Magic Oldies Florida preset_004 = stream.laut.fm/kinderlieder-123 # 4 - Kinderlieder preset_005 = icecast.omroep.nl:80/radio1-bb-mp3 # 5 - Radio 1, NL preset_006 = icecast.omroep.nl:80/radio5-bb-mp3 # 6 - Radio 5, NL preset_007 = icecast.omroep.nl:80/radio2-bb-mp3 # 7 - Radio 2, NL preset_008 = www.antenne.de/webradio/antenne.m3u preset_009 = webstream.schlagerparadies.de:80/schlagerparadies128k.mp3
toneha = 0 tonehf = 0 tonela = 0 tonelf = 0
volume = 5
wifi_00 = ADSL-11_plus/xxxxxx wifi_01 = NETGEAR-11/xxxxxx wifi_02 = ADSL-11/xxxxxx
Define ETHERNET, not ETHENET.
Already corrected, the compilation errors are the same - all with the TFT functions.
This is my workspace:
Complicated, because it is different than in the Github repositry:
And what do you mean by installing Adafruit libraries? All librararies are installed by teh platformio.ini file.
I don't use platformio, i still use the regular arduino IDE since years now. I checked every single library needed, they are all installed correctly.
I just tried to switch to an ILI9341, but the compilation errors are the same. It has something to do with the use of the graphic libs.
Yes, I see now. Be sure to use one of my display libraries. There 'TFTSECS' is defined in the header file of the configured display.