mair / esp32-course Goto Github PK
View Code? Open in Web Editor NEWCourse on the ESP32 IDF
Home Page: https://learnesp32.com
Course on the ESP32 IDF
Home Page: https://learnesp32.com
Exercise 5.1
Ubuntu 20.04
../main/main.c: In function 'exclaimIt':
../main/main.c:70:3: error: passing argument 1 to restrict-qualified parameter aliases with argument 3 [-Werror=restrict]
sprintf(phrase, "%s!", phrase);
^~~~~~~
cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed.
The terminal process "/bin/bash '--init-file', '/home/davem/esp/esp-idf/export.sh', '-i', '-c', 'cmake --build .'" terminated with exit code: 1.
I have created a BLE beacon device which I am able to search in phone app but its not visible to esp32 when I use the BLE GATT client example. while other devices are visible.
Is there any difference is scanning for BLE beacons and BLE server devices?
Hello Mr. Mair,
I hope this finds you well.
About the new Bluetooth documentation, Would you explain how we can reach the Descriptors and Characteristics that are related to the service and know if it is optional or not that appeared as an XML file in the GATT Read video?
What I found on the Bluetooth website is just a 16-bit UUID Numbers Document that lists the GATT services and characteristics in a raw:
https://btprodspecificationrefs.blob.core.windows.net/assigned-values/16-bit%20UUID%20Numbers%20Document.pdf
Thank you in advance.
Have done the last example of hibernation in the sleep modes and found interesting behavior.
1-ESP32 works without power in hibernation for 30 seconds.
2-during the 30 seconds if i connect the power again it wakes-up and perform normal.
3-if i connect the power after the 30 seconds have passed, i find that board cannot wake-up or even restart. it only works again if i force reset it with the board RST button. (any solution to let the board work properly from hibernation?)
I am following along the lecture and was running the code
https://github.com/Mair/esp32-course/blob/master/_19_bluetooth_BLE/_19_3_GAPP/main/main.c
I am able to see the BLE advertisement, but not able to pair using mobile (Andoird >5) and desktop (Ubuntu 20). Does it pair only on Windows?
Hi there, whenever I try to run the program _10_3_Input_interupt
, my device crashes. I realized that if there is an infinite loop in app_main
or if I add vTaskDelete(NULL);
as the last line in the app_main function the code works. I have no clue why. I was hoping you could shine a light on this.
This does not work for me:
void app_main()
{
gpio_pad_select_gpio(PIN_SWITCH);
gpio_set_direction(PIN_SWITCH, GPIO_MODE_INPUT);
gpio_pulldown_en(PIN_SWITCH);
gpio_pullup_dis(PIN_SWITCH);
gpio_set_intr_type(PIN_SWITCH, GPIO_INTR_POSEDGE);
interputQueue = xQueueCreate(10, sizeof(int));
xTaskCreate(buttonPushedTask, "buttonPushedTask", 2048, NULL, 1, NULL);
gpio_install_isr_service(0);
gpio_isr_handler_add(PIN_SWITCH, gpio_isr_handler, (void *)PIN_SWITCH);
}
but oddly enough, this does work:
void app_main()
{
gpio_pad_select_gpio(PIN_SWITCH);
gpio_set_direction(PIN_SWITCH, GPIO_MODE_INPUT);
gpio_pulldown_en(PIN_SWITCH);
gpio_pullup_dis(PIN_SWITCH);
gpio_set_intr_type(PIN_SWITCH, GPIO_INTR_POSEDGE);
interputQueue = xQueueCreate(10, sizeof(int));
xTaskCreate(buttonPushedTask, "buttonPushedTask", 2048, NULL, 1, NULL);
gpio_install_isr_service(0);
gpio_isr_handler_add(PIN_SWITCH, gpio_isr_handler, (void *)PIN_SWITCH);
vTaskDelete(NULL); // <==== THIS MAKE IT WORK
}
It's my understanding that esp-idf should automatically call vTaskDelete(NULL); after calling app_main(). I don't understand why I had to add it to make it work. Any idea? Thanks.
Output of monitor
I (0) cpu_start: App cpu up.
I (240) heap_init: Initializing. RAM available for dynamic allocation:
I (246) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (252) heap_init: At 3FFB28A0 len 0002D760 (181 KiB): DRAM
I (259) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (265) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (271) heap_init: At 40089FC8 len 00016038 (88 KiB): IRAM
I (278) cpu_start: Pro cpu start user code
I (296) spi_flash: detected chip: generic
I (296) spi_flash: flash io: dio
W (297) spi_flash: Detected size(4096k) larger than the size in the binary image header(2048k). Using the size in the binary image header.
I (307) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
Guru Meditation Error: Core 0 panic'ed (IllegalInstruction). Exception was unhandled.
Memory dump at 0x400d189c: e5b7f665 00000131 0c004136
0x400d189c: main_task at C:/esp/esp-idf/components/esp32/cpu_start.c:594 (discriminator 2)
Core 0 register dump:
PC : 0x400d18a2 PS : 0x00060030 A0 : 0x800846b0 A1 : 0x3ffb4710
0x400d18a2: main_task at cpu_start.c:?
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00060023 A5 : 0x3ffb22c8
A6 : 0x3ffb47c8 A7 : 0x00000000 A8 : 0x800d18a2 A9 : 0x3ffb46e0
A10 : 0x3ff48000 A11 : 0x00000001 A12 : 0x00000001 A13 : 0x00060023
A14 : 0x00000001 A15 : 0x00060023 SAR : 0x00000011 EXCCAUSE: 0x00000000
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace:0x400d189f:0x3ffb4710 0x400846ad:0x3ffb4740
0x400d189f: main_task at C:/esp/esp-idf/components/esp32/cpu_start.c:602 (discriminator 2)
0x400846ad: vPortTaskWrapper at C:/esp/esp-idf/components/freertos/xtensa/port.c:143
ELF file SHA256: 84c3f343b23feb95
Rebooting...
Hi dear collaborators,
It will very good, If you create a tutorial or suggest any program for Alexa enable switch using ESP-IDF. Its required in my project. I got some turorial on internet but they are Arduino. I want to create 2-Channel relay with Alexa Vioce Assistance using ESP-IDF on ESP32.
Learn ESP32 course is Best for my learning. Your effort and way of teaching is very good. I learn't a lot from this course.
Thank so much.
A small issue that Bluetooth Documentation recently changed to this link to be a PDF downloaded from this link : https://www.bluetooth.com/specifications/assigned-numbers/
Hi, I need modbus for my project, however I am having a hard time implementing modbus on esp32. I would really appreciate if you could explain the modbus procedure in this course. Thanks
In _19_6_Client_GAPP the timer remains running even when a client unsubscribes.
This behaviour does not match the tutorial.
Following the video content:
https://learnesp32.com/videos/internet-rest-client/simple-get
The website https://quotes.rest/qod is not showing the same content as in the video.
Hi, I'm very new to web development. I followed all the instructions to install Svelte, Tailwind and DaisyUI. When I do npm run dev
, site works fine. When I give npm run build
, a build folder is generated under site but it has not index.html file so I can't read it from SPIFFS and return to the browser for rendering.
I tried npm run preview
, site still seems to be working properly on localhost:3000
Attaching screenshot of contents of my site/build directory and assets fetched when hitting localhost:3000
Unable to proceed further, please advise!
When I came to the lesson "BLE GATT Write" (link: https://www.learnesp32.com/20_ble-gatt-write) Although I copied the author's sample code and loaded it into the ESP32 device, when I using the software "BLE Scanner" (the author used this software in the lesson to scan BLE devices), the software can only see my ESP32 device, but cannot connect (Read, write information to callback function).
This is the image when the software detects the ESP32 device (name of device is: "MY BLE DEVICE")
This is the image when the software connects to the ESP32 device
Here is my project link: https://drive.google.com/file/d/1yo7jAUtWQ6I8MZ81gAQa41cVNeJG7FoC/view?usp=sharing
I have tried many ways and tried to find the cause but still no success!
Looking forward to hearing from you soon!
Thank you guys for the help!
Hi there, I tried this example in your learn ESP32 course and found that when I put a number bigger than 2100 seconds (35 minutes) the ESP32 restarts and keep restarting, could you tell me why ?
Thanks ,,,
void start_sleep_mode(uint16_t sleepInSeconds) { if (sleepInSeconds > 2100) { sleepInSeconds = 2100; } unsigned long long mySleeptime = (sleepInSeconds * 1000000); esp_sleep_enable_ext0_wakeup(GPIO_NUM_4, 1); if (esp_sleep_enable_timer_wakeup(mySleeptime) == ESP_OK) { printf("Valid sleeping time!\n\n"); esp_deep_sleep_start(); } else { printf("Value Exceeds the limit!\n"); } }
Hi, I am trying to use this http client example but I am not able to visualize the data received, I am able to receive and parse JSON data on post request without header but when I add header , which is required for this one particular request the buffer shows no data , while param.message shows ?????? in terminal.
Following is my request format
`struct FetchParams dataStruct;
dataStruct.OnDataRcv =OnDataRcv;
dataStruct.method=Post;
Header headerContentType = {
.key="Content-Type",
.val="Application/json"
};
Header headerAuth = {
.key="Authorization",
.val=(char *)my_authCode
//.val="Bearer 249174ddf663787f4ea605e5ef3c4996c03601543e5994a0d422adbe397c8d9e971560149708740"
};
dataStruct.header[0]=headerAuth;
dataStruct.header[1]=headerContentType;
char buffer[300];
requestBody(clientId,authToken,buffer);
dataStruct.body=buffer;
fetch("https://api.test.fyta-app.de/hub/auth",&dataStruct);`
I have checked with postman , it returns the following output data
{
"access_token": "170ea98ce3fb4f7fc0955a3277e5f0ab9c9d3abad59b435553d36f11b0c81b2b731618926240929",
"token_type": "Bearer",
"expires_in": 86400,
"refresh_token": "17b52fd903fec46f884fa5a1431f30a7f5556663408b9a521bfa6437254731f4ec1618926240930",
"scope": "hub"
}
I have this same issue of no '/build' folder and a failed run of
npm run build
with the svelte.config.js file that was updated last year.
PS C:\Users\pkose\esp-workspace\svelte_example\site> npm run build
[email protected] build
svelte-kit sync && svelte-package
Unexpected option config.kit.prerender.default
at file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/options.js:279:12
at file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/options.js:286:18
at file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/options.js:286:18
at validate_config (file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/index.js:108:9)
at process_config (file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/index.js:80:20)
at load_config (file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/core/config/index.js:72:9)
at async file:///C:/Users/pkose/esp-workspace/svelte_example/site/node_modules/@sveltejs/kit/src/cli.js:36:19
I have cut and pasted the svelte.config.js file provided last April.
I appreciate all that I have learned in the course, but am unable to make progress past this point in this chapter.
Thank you
Peter
Good afternoon everyone.
It does not work with this setup:
Operating System: windows 10
Java Runtime Version: 17.0.6+10-LTS
Eclipse Version: 4.25.0.v20220831-1800
Eclipse CDT Version: 10.7.1.202208160035
IDF Eclipse Plugin Version: 2.9.1.202304060814
ESP-IDF v5.0.1-dirty
Python set for IDF_PYTHON_ENV: Python 3.11.2
The following erros occurred:
Thanks
Edevald
Line 25 : ESP_LOGE(TAG, "Failed to allocate memory");
Correction : ESP_LOGI(TAG, "Failed to allocate memory");
Shouldn't it be ESP_LOGI() and if it is then it Allocates memory.
I was getting this error & a crash loop when trying to use the first BLE iBeacon example with a DEVKIT v1 board:
E (372) psram: PSRAM ID read error: 0xffffffff
E (376) cpu_start: Failed to init external RAM!
After some research and realizing it has no external RAM, the solution was to change this configuration:
Component config -> ESP32-specific -> Support for external, SPI-connected RAM -> DISABLE
Thought this might be a good thing to mention as you recommend this board but it doesn't seem to be the default selection in menuconfig
:/ESP/COURSE/iBeacon/main/main.c: In function 'app_main':
C:/ESP/COURSE/iBeacon/main/main.c:33:5: error: implicit declaration of function 'esp_nimble_hci_and_controller_init' [-Werror=implicit-function-declaration]
33 | esp_nimble_hci_and_controller_init();
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: some warnings being treated as errors
ninja: build stopped: subcommand failed.
This is my issue
line 5 is a duplicate of line 1.
#include <stdio.h>
is called twice.
line 5 should be #include <stdlib.h>
Hello Mr. Swartz
In LearnESP32 Course
Section#5: Fundamentals in FreeRTOS
Part#5: FreeRTOS Tasks Decision Tree
the problem:
the click's image link to open the chart does not work to open the chart image.
Could not build without changing status and content length to int.
{ ESP_LOGI(TAG, "HTTP GET status = %d, content_length = %d", esp_http_client_get_status_code(client), esp_http_client_get_content_length(client)); }
{ ESP_LOGI(TAG, "HTTP GET status = %d, content_length = %d", (int)esp_http_client_get_status_code(client), (int)esp_http_client_get_content_length(client)); }
In ESP32 ADC configuration we can attenuation input voltage to measure voltage higher than Vref. According to the table of the section "ADC Attenuation" higher measurable input voltage range with higher attenuation (ADC_ATTEN_DB_11) is 150 ... 2450mV.
Now the question is:
1- How can I measure input voltage highr than 2450mV till VCC ?
2- Why does the measured voltage not reach 0 ?
Hi this is not really an issue related to the code, but the sequence of chapters. Upto chapter 3, everything seems to be in sequence, however, the chapter 4 "OCD debugging" seems to out of sequence, i.e. its not linking with previous chapters and suddenly the difficulty level in "debugging" chapter rises exponentially.
I've been following the course and am currently trying out ESP-NOW. I wanted to get the mac-addresses like showed in Video "ESP-NOW basic" until minute 06:00. I get the following error message: implicit declaration of function 'esp_efuse_mac_get_default' [-Werror=implicit-function-declaration]
I've set up the enviroment correctly. Here is my code with German and English comments:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_wifi.h"
#include "esp_log.h"
#include "nvs_flash.h"
#include "esp_now.h"
#define TAG "ESP_NOW"
char * mac_to_str(char *buffer, uint8_t *mac) //DE: Mac-Adresse zu String in Hexadezimal EN: Mac-Address to String in Hex
{
sprintf(buffer, "%02x%02x%02x%02x%02x%02x", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
return buffer;
}
void app_main(void)
{
uint8_t my_mac[6]; //DE: Array von 6 Bytes wird erstellt EN: Array of 6 Bytes gets created
esp_efuse_mac_get_default(my_mac); //DE: Die Mac-Adresse wird im Array gespeichert EN: The mac-address gets saved in the array
char my_mac_str[13]; //Buffer
ESP_LOGI(TAG, "My mac %s*", mac_to_str(my_mac_str, my_mac)); //DE: Mac-Adresse wird ins Terminal geschrieben EN: Mac-address gets sent to the terminal
}
How do I fix this issue?
Hi Mair!
I get error Not found: /api/get-ap-list when practice website proxy. I open http://localhost:5173/api/get-ap-list browser, browser show 404 not found.
Could you help me!
Thank you so much!
Hi, i would help on how to connect using the mqtt library to azure iot hub.
my cofiguration is the following ;
#define DigiCertGlobalRootG2 "-----BEGIN CERTIFICATE-----\n
MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBh\n
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3\n
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBH\n
MjAeFw0xMzA4MDExMjAwM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END CERTIFICATE-----\0"
;
const esp_mqtt_client_config_t mqtt_cfg = {
.uri = "mqtts://myhub.azure-devices.net:8883",
.client_id = "mydev",
.username = "myub.azure-devices.net/mydev/?api-version=2020-09-30"
.password = "SharedAccessSignature sr=myhub.azure-devices.net%2Fdevices%2Fmydev&sig=auce3pCr2IHM4TcKGKa*UkZRFHmOt8%3D&se=1688990618",
.cert_pem = DigiCertGlobalRootG2
//.cert_len = sizeof(DigiCertGlobalRootG2),
//.port = 8883,
//.disable_auto_reconnect = true,
.lwt_qos = 1,
//.transport = MQTT_TRANSPORT_OVER_SSL,
.protocol_ver = MQTT_PROTOCOL_V_3_1_1,
};
esp_err_t err;
esp_mqtt_client_handle_t client = esp_mqtt_client_init(&mqtt_cfg);
esp_mqtt_client_register_event(client, ESP_EVENT_ANY_ID, mqtt_event_handler, client);
err = esp_mqtt_client_start(client);
ESP_LOGI (TAG, "Client connect. Error = %d %s", err, esp_err_to_name (err));
When Trying to connect i get the error
�[0;31mE (139187) esp-tls-mbedtls: mbedtls_ssl_handshake returned -0x2700
�[0;32mI (139187) esp-tls-mbedtls: Failed to verify peer certificate!
�[0;31mE (139197) esp-tls: Failed to open new connection
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.