Skip to content

Commit 92a53b0

Browse files
authored
Merge pull request #102 from s-hadinger/fix_psram_crash_pico_d4
Fix psram crash pico d4
2 parents 4cf6406 + f256aab commit 92a53b0

File tree

9 files changed

+109
-18
lines changed

9 files changed

+109
-18
lines changed

Diff for: .github/workflows/publish.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: Unit Test Results
33
on:
44
workflow_run:
55
workflows: [Run tests in hardware]
6+
branches-ignore: [master]
67

78
types:
89
- completed
@@ -11,6 +12,9 @@ jobs:
1112
unit-test-results:
1213
name: Unit Test Results
1314
runs-on: ubuntu-latest
15+
if: |
16+
github.event.workflow_run.event == 'pull_request' &&
17+
github.event.workflow_run.conclusion != 'skipped'
1418
steps:
1519
- name: Download and Extract Artifacts
1620
env:

Diff for: cores/esp32/esp32-hal-psram.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ bool psramInit(){
5656
#if CONFIG_IDF_TARGET_ESP32
5757
uint32_t chip_ver = REG_GET_FIELD(EFUSE_BLK0_RDATA3_REG, EFUSE_RD_CHIP_VER_PKG);
5858
uint32_t pkg_ver = chip_ver & 0x7;
59-
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2) {
59+
if (pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32D2WDQ5 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD2 || pkg_ver == EFUSE_RD_CHIP_VER_PKG_ESP32PICOD4) {
6060
spiramFailed = true;
6161
log_w("PSRAM not supported!");
6262
return false;

Diff for: libraries/AsyncUDP/src/AsyncUDP.h

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "IPAddress.h"
55
#include "IPv6Address.h"
66
#include "Print.h"
7+
#include "Stream.h"
78
#include <functional>
89
extern "C" {
910
#include "lwip/ip_addr.h"

Diff for: libraries/WiFi/examples/WiFiClientEnterprise/WiFiClientEnterprise.ino

+23-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
#include <WiFi.h> //Wifi library
22
#include "esp_wpa2.h" //wpa2 library for connections to Enterprise networks
33
#define EAP_IDENTITY "login" //if connecting from another corporation, use [email protected] in Eduroam
4+
#define EAP_USERNAME "login" //oftentimes just a repeat of the identity
45
#define EAP_PASSWORD "password" //your Eduroam password
56
const char* ssid = "eduroam"; // Eduroam SSID
67
const char* host = "arduino.php5.sk"; //external server domain for HTTP connection after authentification
78
int counter = 0;
9+
10+
// NOTE: For some systems, various certification keys are required to connect to the wifi system.
11+
// Usually you are provided these by the IT department of your organization when certs are required
12+
// and you can't connect with just an identity and password.
13+
// Most eduroam setups we have seen do not require this level of authentication, but you should contact
14+
// your IT department to verify.
15+
// You should uncomment these and populate with the contents of the files if this is required for your scenario (See Example 2 and Example 3 below).
16+
//const char *ca_pem = "insert your CA cert from your .pem file here";
17+
//const char *client_cert = "insert your client cert from your .crt file here";
18+
//const char *client_key = "insert your client key from your .key file here";
19+
820
void setup() {
921
Serial.begin(115200);
1022
delay(10);
@@ -13,11 +25,17 @@ void setup() {
1325
Serial.println(ssid);
1426
WiFi.disconnect(true); //disconnect form wifi to set new wifi connection
1527
WiFi.mode(WIFI_STA); //init wifi mode
16-
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide identity
17-
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); //provide username --> identity and username is same
18-
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); //provide password
19-
esp_wifi_sta_wpa2_ent_enable();
20-
WiFi.begin(ssid); //connect to wifi
28+
29+
// Example1 (most common): a cert-file-free eduroam with PEAP (or TTLS)
30+
WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD);
31+
32+
// Example 2: a cert-file WPA2 Enterprise with PEAP
33+
//WiFi.begin(ssid, WPA2_AUTH_PEAP, EAP_IDENTITY, EAP_USERNAME, EAP_PASSWORD, ca_pem, client_cert, client_key);
34+
35+
// Example 3: TLS with cert-files and no password
36+
//WiFi.begin(ssid, WPA2_AUTH_TLS, EAP_IDENTITY, NULL, NULL, ca_pem, client_cert, client_key);
37+
38+
2139
while (WiFi.status() != WL_CONNECTED) {
2240
delay(500);
2341
Serial.print(".");

Diff for: libraries/WiFi/src/WiFiSTA.cpp

+62
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ extern "C" {
4242
#include "lwip/dns.h"
4343
#include <esp_smartconfig.h>
4444
#include <esp_netif.h>
45+
#include "esp_wpa2.h"
4546
}
4647

4748
// -----------------------------------------------------------------------------------------------------------------------
@@ -145,6 +146,67 @@ wl_status_t WiFiSTAClass::status()
145146
return (wl_status_t)xEventGroupClearBits(_sta_status_group, 0);
146147
}
147148

149+
/**
150+
* Start Wifi connection with a WPA2 Enterprise AP
151+
* if passphrase is set the most secure supported mode will be automatically selected
152+
* @param ssid const char* Pointer to the SSID string.
153+
* @param method wpa2_method_t The authentication method of WPA2 (WPA2_AUTH_TLS, WPA2_AUTH_PEAP, WPA2_AUTH_TTLS)
154+
* @param wpa2_identity const char* Pointer to the entity
155+
* @param wpa2_username const char* Pointer to the username
156+
* @param password const char * Pointer to the password.
157+
* @param ca_pem const char* Pointer to a string with the contents of a .pem file with CA cert
158+
* @param client_crt const char* Pointer to a string with the contents of a .crt file with client cert
159+
* @param client_key const char* Pointer to a string with the contants of a .key file with client key
160+
* @param bssid uint8_t[6] Optional. BSSID / MAC of AP
161+
* @param channel Optional. Channel of AP
162+
* @param connect Optional. call connect
163+
* @return
164+
*/
165+
wl_status_t WiFiSTAClass::begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity, const char* wpa2_username, const char *wpa2_password, const char* ca_pem, const char* client_crt, const char* client_key, int32_t channel, const uint8_t* bssid, bool connect)
166+
{
167+
if(!WiFi.enableSTA(true)) {
168+
log_e("STA enable failed!");
169+
return WL_CONNECT_FAILED;
170+
}
171+
172+
if(!wpa2_ssid || *wpa2_ssid == 0x00 || strlen(wpa2_ssid) > 32) {
173+
log_e("SSID too long or missing!");
174+
return WL_CONNECT_FAILED;
175+
}
176+
177+
if(wpa2_identity && strlen(wpa2_identity) > 64) {
178+
log_e("identity too long!");
179+
return WL_CONNECT_FAILED;
180+
}
181+
182+
if(wpa2_username && strlen(wpa2_username) > 64) {
183+
log_e("username too long!");
184+
return WL_CONNECT_FAILED;
185+
}
186+
187+
if(wpa2_password && strlen(wpa2_password) > 64) {
188+
log_e("password too long!");
189+
}
190+
191+
if(ca_pem) {
192+
esp_wifi_sta_wpa2_ent_set_ca_cert((uint8_t *)ca_pem, strlen(ca_pem));
193+
}
194+
195+
if(client_crt) {
196+
esp_wifi_sta_wpa2_ent_set_cert_key((uint8_t *)client_crt, strlen(client_crt), (uint8_t *)client_key, strlen(client_key), NULL, 0);
197+
}
198+
199+
esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)wpa2_identity, strlen(wpa2_identity));
200+
if(method == WPA2_AUTH_PEAP || method == WPA2_AUTH_TTLS) {
201+
esp_wifi_sta_wpa2_ent_set_username((uint8_t *)wpa2_username, strlen(wpa2_username));
202+
esp_wifi_sta_wpa2_ent_set_password((uint8_t *)wpa2_password, strlen(wpa2_password));
203+
}
204+
esp_wifi_sta_wpa2_ent_enable(); //set config settings to enable function
205+
WiFi.begin(wpa2_ssid); //connect to wifi
206+
207+
return status();
208+
}
209+
148210
/**
149211
* Start Wifi connection
150212
* if passphrase is set the most secure supported mode will be automatically selected

Diff for: libraries/WiFi/src/WiFiSTA.h

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@
3030
#include "esp_event.h"
3131
#endif
3232

33+
typedef enum {
34+
WPA2_AUTH_TLS = 0,
35+
WPA2_AUTH_PEAP = 1,
36+
WPA2_AUTH_TTLS = 2
37+
} wpa2_auth_method_t;
3338

3439
class WiFiSTAClass
3540
{
@@ -39,6 +44,7 @@ class WiFiSTAClass
3944

4045
public:
4146

47+
wl_status_t begin(const char* wpa2_ssid, wpa2_auth_method_t method, const char* wpa2_identity=NULL, const char* wpa2_username=NULL, const char *wpa2_password=NULL, const char* ca_pem=NULL, const char* client_crt=NULL, const char* client_key=NULL, int32_t channel=0, const uint8_t* bssid=0, bool connect=true);
4248
wl_status_t begin(const char* ssid, const char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
4349
wl_status_t begin(char* ssid, char *passphrase = NULL, int32_t channel = 0, const uint8_t* bssid = NULL, bool connect = true);
4450
wl_status_t begin();

Diff for: variants/adafruit_feather_esp32_v2/pins_arduino.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,19 @@ static const uint8_t A9 = 33;
4242
static const uint8_t A10 = 27;
4343
static const uint8_t A11 = 12;
4444
static const uint8_t A12 = 13;
45+
static const uint8_t A13 = 35;
4546

4647
// vbat measure
47-
static const uint8_t BATT_MONITOR = 35;
48-
static const uint8_t A13 = 35;
48+
#define BATT_MONITOR 35
4949

5050
// internal switch
51-
static const uint8_t BUTTON = 38;
51+
#define BUTTON = 38;
5252

5353
// Neopixel
54-
static const uint8_t NEOPIXEL_PIN = 0;
55-
static const uint8_t PIN_NEOPIXEL = 0;
54+
#define PIN_NEOPIXEL 0
5655

5756
// Neopixel & I2C power
58-
static const uint8_t NEOPIXEL_I2C_POWER = 2;
57+
#define NEOPIXEL_I2C_POWER 2
5958

6059
static const uint8_t T0 = 4;
6160
static const uint8_t T1 = 0;

Diff for: variants/adafruit_feather_esp32s2/variant.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ void initVariant(void)
3636
pinMode(NEOPIXEL_POWER, OUTPUT);
3737
digitalWrite(NEOPIXEL_POWER, HIGH);
3838

39-
// This board has a power control pin, and we must set it to output and low
40-
// in order to enable the I2C port.
39+
// turn on the I2C power by setting pin to opposite of 'rest state'
40+
pinMode(PIN_I2C_POWER, INPUT);
41+
delay(1);
42+
bool polarity = digitalRead(PIN_I2C_POWER);
4143
pinMode(PIN_I2C_POWER, OUTPUT);
42-
digitalWrite(PIN_I2C_POWER, LOW);
44+
digitalWrite(PIN_I2C_POWER, !polarity);
4345
}
44-
4546
}

Diff for: variants/adafruit_qtpy_esp32c3/pins_arduino.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#define digitalPinToInterrupt(p) (((p)<NUM_DIGITAL_PINS)?(p):-1)
1212
#define digitalPinHasPWM(p) (p < EXTERNAL_NUM_INTERRUPTS)
1313

14-
static const uint8_t SWITCH = 9;
15-
static const uint8_t NEOPIXEL_PIN = 2;
14+
#define BUTTON 9
15+
#define PIN_NEOPIXEL 2
1616

1717
static const uint8_t TX = 21;
1818
static const uint8_t RX = 20;

0 commit comments

Comments
 (0)