Both Ethernet and BLE works fine separately but when I compile them together, my board (WT32-ETH01) keep getting reset.
After some trial and error, I found out that ETH.begin()
is having conflict with BLEDevice::init()
. So I dig into the code and found out BLEDevice::init()
function is using vTaskDelay which means that freeRTOS is implemented on it. Whereas ETH.begin()
function is using delay(); Maybe this could be the reason?
Anyone have experience on how to overcome this? example:
`
#include <ETH.h>
#include <WiFi.h>
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
/*
* ETH_CLOCK_GPIO0_IN - default: external clock from crystal oscillator
* ETH_CLOCK_GPIO0_OUT - 50MHz clock from internal APLL output on GPIO0 - possibly an inverter is needed for LAN8720
* ETH_CLOCK_GPIO16_OUT - 50MHz clock from internal APLL output on GPIO16 - possibly an inverter is needed for LAN8720
* ETH_CLOCK_GPIO17_OUT - 50MHz clock from internal APLL inverted output on GPIO17 - tested with LAN8720
*/
#define ETH_CLK_MODE ETH_CLOCK_GPIO17_OUT
// Pin# of the enable signal for the external crystal oscillator (-1 to disable for internal APLL source)
#define ETH_POWER_PIN 16 // GPIO16, HS1_DATA4, U2RXD, EMAC_CLK_OUT
// Type of the Ethernet PHY (LAN8720 or TLK110)
#define ETH_TYPE ETH_PHY_LAN8720
// I²C-address of Ethernet PHY (0 or 1 for LAN8720, 31 for TLK110)
#define ETH_ADDR 1
// Pin# of the I²C clock signal for the Ethernet PHY
#define ETH_MDC_PIN 23 // GPIO23, VSPID, HS1_STROBE
// Pin# of the I²C IO signal for the Ethernet PHY
#define ETH_MDIO_PIN 18 // GPIO18, VSPICLK, HS1_DATA7
void setup()
{
Serial.begin(115200);
// Create and name the BLE Device
BLEDevice::init("DEVICE_NAME");
Serial.println("DEBUG_1"); // DEBUG
ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE);
Serial.println("DEBUG_2"); // DEBUG
}
void loop()
{}
`
This is the most simplified way to reproduce the issue. I know there is still a lot in between. Just to avoid any further confusion and straight to the point, I am trying my best to simplify it. Try commenting out the ETH.begin(), it will work.
Ok, for those who met the same issue, here is the solution: Open the "tools" on top of our Arduino IDE Tools > Partition Scheme > Huge APP.