Hi,
I am trying to get some basic control over a XIAO ESP32-C3. I uploaded the board data to my IDE and everything seems to be recognized. I tried to run a basic example sketch for the ESP32 and I get the following results. The error codes seem to be consistent across the sketches I have tried to upload so I believe I have still not gotten all of my settings secured.
I compile and upload the code, but it doesn't quite happen. I do not understand the last line "Hand resetting via reset pin." Can anyone please direct me to that which I am totally missing here>
[code]
/*
Repeat timer example
This example shows how to use hardware timer in ESP32. The timer calls onTimer
function every second. The timer can be stopped with button attached to PIN 0
(IO0).
This example code is in the public domain.
*/
// Stop button is attached to PIN 0 (IO0)
#define BTN_STOP_ALARM 0
hw_timer_t * timer = NULL;
volatile SemaphoreHandle_t timerSemaphore;
portMUX_TYPE timerMux = portMUX_INITIALIZER_UNLOCKED;
volatile uint32_t isrCounter = 0;
volatile uint32_t lastIsrAt = 0;
void ARDUINO_ISR_ATTR onTimer(){
// Increment the counter and set the time of ISR
portENTER_CRITICAL_ISR(&timerMux);
isrCounter++;
lastIsrAt = millis();
portEXIT_CRITICAL_ISR(&timerMux);
// Give a semaphore that we can check in the loop
xSemaphoreGiveFromISR(timerSemaphore, NULL);
// It is safe to use digitalRead/Write here if you want to toggle an output
}
void setup() {
Serial.begin(115200);
// Set BTN_STOP_ALARM to input mode
pinMode(BTN_STOP_ALARM, INPUT);
// Create semaphore to inform us when the timer has fired
timerSemaphore = xSemaphoreCreateBinary();
// Use 1st timer of 4 (counted from zero).
// Set 80 divider for prescaler (see ESP32 Technical Reference Manual for more
// info).
timer = timerBegin(0, 80, true);
// Attach onTimer function to our timer.
timerAttachInterrupt(timer, &onTimer, true);
// Set alarm to call onTimer function every second (value in microseconds).
// Repeat the alarm (third parameter)
timerAlarmWrite(timer, 1000000, true);
// Start an alarm
timerAlarmEnable(timer);
}
void loop() {
// If Timer has fired
if (xSemaphoreTake(timerSemaphore, 0) == pdTRUE){
uint32_t isrCount = 0, isrTime = 0;
// Read the interrupt count and time
portENTER_CRITICAL(&timerMux);
isrCount = isrCounter;
isrTime = lastIsrAt;
portEXIT_CRITICAL(&timerMux);
// Print it
Serial.print("onTimer no. ");
Serial.print(isrCount);
Serial.print(" at ");
Serial.print(isrTime);
Serial.println(" ms");
}
// If button is pressed
if (digitalRead(BTN_STOP_ALARM) == LOW) {
// If timer is still running
if (timer) {
// Stop and free timer
timerEnd(timer);
timer = NULL;
}
}
}
[/code]
Following are the error messages:
Sketch uses 240986 bytes (18%) of program storage space. Maximum is 1310720 bytes.
Global variables use 13684 bytes (4%) of dynamic memory, leaving 313996 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.5.1
Serial port COM4
Connecting...
Chip is ESP32-C3 (revision v0.4)
Features: WiFi, BLE
Crystal is 40MHz
MAC: 34:85:18:07:c8:3c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Erasing flash (this may take a while)...
Chip erase completed successfully in 17.6s
Compressed 13200 bytes to 9522...
Writing at 0x00000000... (100 %)
Wrote 13200 bytes (9522 compressed) at 0x00000000 in 0.2 seconds (effective 486.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 495.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 755.2 kbit/s)...
Hash of data verified.
Compressed 252272 bytes to 139867...
Writing at 0x00010000... (11 %)
Writing at 0x0001b098... (22 %)
Writing at 0x0002312a... (33 %)
Writing at 0x00029331... (44 %)
Writing at 0x0002f539... (55 %)
Writing at 0x000354e7... (66 %)
Writing at 0x0003d306... (77 %)
Writing at 0x00043eec... (88 %)
Writing at 0x0004a082... (100 %)
Wrote 252272 bytes (139867 compressed) at 0x00010000 in 2.3 seconds (effective 895.4 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...