ESP32-Radio
ESP32-Radio copied to clipboard
How to use HELTEC WiFi Kit 32
Dear Sirs, I tried but unsuccessfully to work the HELTEC WiFi Kit 32 dev board with the ESP32-Radio. For your info, the attached pdf shows all the pins of this dev board, also the occupied pins regarding the I2C OLED ( that now supported in the ESP32-Radio thanks to Mr. @Edzelf with his recent inclusion ). If someone of you have this dev board working, or can suggest me what to do please send me a note. All of my tries has always continious reset to ESP32... Thanks and Best Regards, Mike Kranidis HELTEC WIFI_Kit_32-Diagram.pdf
First, try to run the radio software without anything attached (or configured) to the Heltec board. If it does not crash, add the VS1063 and finally the OLED. Remember to first run radio-init, so you can check the WIFi.
Dear @Edzelf , what I already tried is to put the correct I2C pins OLED_scl=15, OLED_sda=4, OLED_rst=16. I successfully compiled then the "main" ino file ESP32_radio.ino and then I did power on/off to the HELTEC dev board. Looking at the serial port, it started and after a few seconds do reset again and again. I am not sure regarding your suggestion: " Remember to first run radio-init, so you can check the WIFi. ". What is that? Again thanks and Best Regards, Mike Kranidis
I run first: Esp32_radio_init.ino but it did not helps. See:
D: Starting ESP32-radio running on CPU 1 at 240 MHz. Version Wed, 25 Apr 2018 14:45:00 GMT. Free memory 171084
D: Partition nvs found, 20480 bytes
D: Read 31 keys from NVS
D: pin_ir set to -1
D: pin_enc_clk set to -1
D: pin_enc_dt set to -1
D: pin_enc_sw set to -1
D: pin_tft_cs set to -1
D: pin_tft_dc set to -1
D: pin_tft_scl set to 15
D: pin_tft_sda set to 4
D: pin_sd_cs set to -1
D: pin_vs_cs set to 5
D: pin_vs_dcs set to 17
D: pin_vs_dreq set to 4
D: pin_shutdown set to -1
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 LOW, probably no PULL-UP
D: GPIO35 is LOW, probably no PULL-UP
D: gpio_00 will execute uppreset = 1
D: gpio_12 will execute upvolume = 2
D: gpio_13 will execute downvolume = 2
D: Start display
D: Init TFT 4 15
D: Create list with acceptable WiFi networks
Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x4008c90d PS : 0x00060033 A0 : 0x4008dd93 A1 : 0x3ffd6b30
A2 : 0x00050023 A3 : 0x00000001 A4 : 0x3ffc8a74 A5 : 0x3ffc8c34
A6 : 0x00000001 A7 : 0x3ffc8c68 A8 : 0x00000016 A9 : 0x00000002
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3ffc8c34 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000001 SAR : 0x00000013 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000048 LBEG : 0x40001609 LEND : 0x4000160d LCOUNT : 0x00000000
Backtrace: 0x4008c90d:0x3ffd6b30 0x4008dd90:0x3ffd6b50 0x4008dd46:0x4008bc90
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:1 load:0x3fff0018,len:4 load:0x3fff001c,len:812 load:0x40078000,len:0 load:0x40078000,len:11572 entry 0x40078a5c
D: Starting ESP32-radio running on CPU 1 at 240 MHz. Version Wed, 25 Apr 2018 14:45:00 GMT. Free memory 171084
D: Partition nvs found, 20480 bytes
D: Read 31 keys from NVS
D: pin_ir set to -1
D: pin_enc_clk set to -1
D: pin_enc_dt set to -1
D: pin_enc_sw set to -1
D: pin_tft_cs set to -1
D: pin_tft_dc set to -1
D: pin_tft_scl set to 15
D: pin_tft_sda set to 4
D: pin_sd_cs set to -1
D: pin_vs_cs set to 5
D: pin_vs_dcs set to 17
D: pin_vs_dreq set to 4
D: pin_shutdown set to -1
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 LOW, probably no PULL-UP
D: GPIO19 is HIGH
D: GPIO21 is HIGH
D: GPIO22 is HIGH
D: GPIO23 is LOW, probably no PULL-UP
D: GPIO25 is HIGH
D: GPIO26 is HIGH
D: GPIO27 is HIGH
D: GPIO32 is HIGH
D: GPIO33 is HIGH
D: GPIO34 is LOW, probably no PULL-UP
D: GPIO35 is LOW, probably no PULL-UP
D: gpio_00 will execute uppreset = 1
D: gpio_12 will execute upvolume = 2
D: gpio_13 will execute downvolume = 2
D: Start display
D: Init TFT 4 15
D: Create list with acceptable WiFi networks
Guru Meditation Error: Core 1 panic'ed (LoadProhibited)
. Exception was unhandled.
Core 1 register dump:
PC : 0x4008c90d PS : 0x00060033 A0 : 0x4008dd93 A1 : 0x3ffd6b30
A2 : 0x00050023 A3 : 0x00000001 A4 : 0x3ffc8a74 A5 : 0x3ffc8c34
A6 : 0x00000001 A7 : 0x3ffc8c68 A8 : 0x00000016 A9 : 0x00000002
A10 : 0x00000000 A11 : 0x00000000 A12 : 0x3ffc8c34 A13 : 0x00000000
A14 : 0x00000000 A15 : 0x00000001 SAR : 0x00000013 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000048 LBEG : 0x40001609 LEND : 0x4000160d LCOUNT : 0x00000000
Backtrace: 0x4008c90d:0x3ffd6b30 0x4008dd90:0x3ffd6b50 0x4008dd46:0x4008bc90
Rebooting...
For radio_init see the documentation: "An extra sketch "Esp32_radio_init" is supplied as an alternative to initialize the preferences (in Non-Voltile Storage of the ESP32). Just change lines 39 and 40 (the specs for WiFi networks) to match your network(s). Upload and run the sketch once and then load the ESP32-Radio."
I also have a Heltec board. I tried it now and it keeps rebooting. I will see what's wronfg with this board.
Dear @Edzelf ,
yes I did, I fount Esp32_radio_init.ino inside the subdirectory tools and I loaded to Arduino IDE. Then after changed the lines 39,40:
preferences.putString ( "wifi_00", "myHomeWiFi/12345678" ) | preferences.putString ( "wifi_01", "SecondWiFi/12345678" ) |
I compiled and sent to ESP32. At the serial I took "ESP32_radio_init completed...".
Then I loaded the Esp32_radio.ino to Arduino IDE and the result is above, keep resetting...
Thanks
The program crashed when no IR was configured. I have made a correction in the new version.
Thanks a lot dear @Edzelf for your fast responce and the bug fixing! I will try it when at home. Have a nice day.
Dear @Edzelf , I have the HELTEC board with me so I can tested in my workplace and I did. I discovered that If I change the "default" display from BLUETFT to OLED then I still get the "always restarting and crashing". If I leave your default BLUETFT then it is starting without problems but without OLED of course. Please check if you can. Thanks
//#define BLUETFT // Works also for RED TFT 128x160
#define OLED // 64x128 I2C OLED
I could not reproduce that. I made a small correction. The display will work now without VS1063.
Sorry something wrong in my browser cache, ignore it dear @Edzelf making the diff between your latest Esp32_radio.ino and the Esp32_radio.ino that was 5 days ago I found them 100% the same. Can you check and make sure that the today changes has been uploaded to github? Thanks
Yeah, wrong directory
Dear @Edzelf , yes it is working now. To help somebody looking the same, to have OLED activated in ESP32-Radio using HELTEC WiFi Kit 32 { ESP32 }, the following changes should be done to Esp32_radio.ino file:
/// change / correct the next two lines 2380, 2381
{ "pin_tft_scl", &ini_block.tft_scl_pin, 15 }, // Display I2C version /// by mikek ///
{ "pin_tft_sda", &ini_block.tft_sda_pin, 4 }, // Display I2C version /// by mikek ///
The only small glitch remained and that is: the OLED does not show correctly the last (?) line, I see only some pixels, but this is trivial.
Thanks a lot Mr. @Edzelf for your help and your fantastic work in ESP32-Radio !!!
Last line on OLED: must be a long text line in the lower section. Try to change the volume, this will paint the last pixel line of the display. And try to run th OLED without using pin 16. I don't think the OLED needs a reset.
Dear @Edzelf Pin 16 must be High in order to get OLED up and running. if you don't initialize then OLED is off.
Yes, I understand. But 16 will be pulled to high by the software. I think it is not necessary to pulse it low for reset.
I agree with you. The temporary low is just for reset as you already told. The only question left: Do you have any provision to pull up GPIO 16 High? Because, before I put it in setup section, the OLED was not started. Thanks.
Dear @Edzelf I am not sure how to connect VS1053 to HELTEC Dev board. Can you suggesting me the pin to pin connections? Thanks.
As I said: Gpio 16 is pulled up by the software. All unused pins are pulled HIGH. You will see it in the debug logging: "D:GPIO16 is HIGH".
Yes you are right, I can confirm @Edzelf that the lines I put at void setup to set GPIO 16 not needed. Thanks
To connect the VS1053 to the Heltec board, you may us someting like:
// Heltec Signal Wired to OLED Wired to VS1053 SDCARD Wired to the rest
// -------- ------ -------------- ------------------- ------ ---------------
// GPIO16 Reset - - -
// GPIO5 - pin 2 XCS - -
// GPIO4 SDA - - -
// GPIO2 - pin 4 DREQ - -
// GPIO17 - - CS -
// GPIO18 SCK - pin 5 SCK CLK -
// GPIO19 MISO - pin 7 MISO MISO -
// GPIO23 MOSI - pin 6 MOSI MOSI -
// GPIO15 SCL - - -
// GPI03 RXD0 - - - Reserved serial input
// GPIO1 TXD0 - - - Reserved serial output
// GPIO34 - - pin 1 XDCS - Optional pull-up resistor
// GPIO35 - - - - Infrared receiver VS1838B
// GPIO25 - - - - Rotary encoder CLK
// GPIO26 - - - - Rotary encoder DT
// GPIO27 - - - - Rotary encoder SW
// ------- ------ --------------- ------------------- ------ ----------------
// GND - pin 8 GND pin 8 GND Power supply GND
// VCC 5 V - pin 7 BL - Power supply
// VCC 5 V - pin 6 VCC pin 9 5V Power supply
// EN - pin 1 RST pin 3 XRST -
Dear @Edzelf
My VS1053 has the following pinout:
VS1053 Module Pin.1 +5V Pin.2 GND Pin.3 CS Pin.4 MISO Pin.5 MOSI Pin.6 SCK Pin.7 XCS Pin.8 XRESET Pin.9 XDCS Pin.10 DEREQ
following your proposed pinout I have two questions,
- What signal is your designated signal ( at HELTEC side ) EN that is connected with XRST of VS1053? My HELTEC board does not have it. I presume that you speak for XRESET as it been referenced to my VS1053 board
- My VS1053 board has also CS. Where to connect ( if any ) ?
Thanks a lot
1 - RST on your Heltec board is the same as EN. 2 - CS is probably for the SD card, so you can use GPIO17 for this.
Dear @Edzelf Many thanks. It is working fine now!
i have same HELTEC WiFi Kit 32 thx, it is ok with oled now but nothing with sound ( i have such blue VS1053 https://ru.aliexpress.com/item/VS1053-MP3-w-On-Board-SPI/32839832382.html?spm=a2g0v.search0604.3.8.27af7892xcHZ9f&ws_ab_test=searchweb0_0%2Csearchweb201602_4_10065_10068_319_10059_10884_317_10887_10696_100031_321_322_10084_453_10083_454_10103_10618_10307_537_536%2Csearchweb201603_51%2CppcSwitch_0&algo_pvid=bb65d642-29d3-4045-a598-38d92f52237c&algo_expid=bb65d642-29d3-4045-a598-38d92f52237c-1 but after connection I hear nothing how to find the reason ?
I had to insert a manual OLED reset to make the display work:
SSD1306.h, first lines of constructor:
//Reset OLED
pinMode(16, OUTPUT);
digitalWrite(16, LOW);
delay(50);
digitalWrite(16, HIGH);
delay(50);
Hi, I have an Heltec ESP32 WiFi Lora Board https://www.fambach.net/esp32-wifi-lora-433/. Therefore the pin layout is different. I have a working PCM5102A and a rotary encoder connected to it.
The OLED display is not working yet.
Before configuring the GPIO I have the error:
E (942333) i2c: i2c_set_pin(860): scl and sda gpio numbers are the same
After adding the OLED GPIO (SCL: 15 and SDA: 4) I get the following error (audio and encoder still works), but not OLED display:
D: pin_enc_clk set to 17
D: pin_enc_dt set to 22
D: pin_enc_sw set to 2
D: pin_tft_scl set to 15
D: pin_tft_sda set to 4
D: pin_i2s_bck set to 25
D: pin_i2s_lck set to 14
D: pin_i2s_din set to 27
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 LOW, probably no PULL-UP
D: GPIO18 is HIGH
D: GPIO19 is HIGH
D: GPIO21 is HIGH
D: GPIO22 is LOW, probably no PULL-UP
D: GPIO23 is HIGH
D: GPIO25 is HIGH
D: GPIO26 is LOW, probably no PULL-UP
D: GPIO27 is HIGH
D: GPIO32 is LOW, probably no PULL-UP
D: GPIO33 is LOW, probably no PULL-UP
D: GPIO34 is LOW, probably no PULL-UP
D: GPIO35 is LOW, probably no PULL-UP
D: GPIO39 is LOW, probabl���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Any suggestion where the problem comes from? (tested the display and gpios with Adafruit GFX library)
The cause is a problem with the Wire.cpp and ESP32 and Platformio. My PlatformIO setup apparently cannot use the Wire.cpp with the ESP32. Simple GFXSketch shows the error: Bus is in Slave Mode. Same GFX script in Arduino IDE causes no problems and OLED works.
Any suggestions which setting/library mismatch causes the error and therefore non-working OLED on Platformio?
Maybe not the cause, but your 3 rotary encoder pins should be high at start-up.
Try to disconnect the display. It may consume too much power for your power supply. Try version 2 of the radio software.
I am testing with a simple code snippet with only i2c scanner + OLED, compiles on both (Arduino IDE and PlatformIO), but only works on the Heltec Dev Board, when compiled on Arduino IDE. Therefore I assume, that the cause has to come from my settings/libraries in PlatformIO.
main.cpp (OLED+i2c works, when compiled with Arduino IDE)
#include "Arduino.h"
#include "heltec.h"
void setup()
{
Heltec.begin(true, false, true);
Wire.begin(SDA_OLED, SCL_OLED); //Scan OLED's I2C address via I2C0
//Wire1.begin(SDA, SCL); //If there have other device on I2C1, scan the device address via I2C1
}
void loop()
{
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ )
{
Wire.beginTransmission(address);
error = Wire.endTransmission();
// Wire1.beginTransmission(address);
// error = Wire1.endTransmission();
if (error == 0)
{
Serial.print("I2C device found at address 0x");
if (address<16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error==4)
{
Serial.print("Unknown error at address 0x");
if (address<16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000);
}
platformio.ini
[env:heltec_wifi_lora_32_Test2]
platform = espressif32
board = heltec_wifi_lora_32
framework = arduino
monitor_speed = 115200
monitor_flags =
--filter=esp32_exception_decoder
--echo
build_flags =
-DCORE_DEBUG_LEVEL=0
-Os
lib_deps =
heltecautomation/Heltec ESP32 Dev-Boards @ ^1.1.0
build output:
Processing heltec_wifi_lora_32_Test2 (platform: espressif32; board: heltec_wifi_lora_32; framework: arduino)
------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/heltec_wifi_lora_32.html
PLATFORM: Espressif 32 (4.2.0) > Heltec WiFi LoRa 32
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
- framework-arduinoespressif32 3.20002.0 (2.0.2)
- tool-esptoolpy 1.30300.0 (3.3.0)
- toolchain-xtensa-esp32 8.4.0+2021r2-patch3
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 44 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Heltec ESP32 Dev-Boards> 1.1.0
| |-- <SPI> 2.0.0
| |-- <Wire> 2.0.0
Building in release mode
Retrieving maximum program size .pio/build/heltec_wifi_lora_32_Test2/firmware.elf
Checking size .pio/build/heltec_wifi_lora_32_Test2/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [= ] 5.3% (used 17436 bytes from 327680 bytes)
Flash: [== ] 19.8% (used 259473 bytes from 1310720 bytes)
=========================== [SUCCESS] Took 2.35 seconds ===========================