Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PeriMan: Improve log messages #8812

Merged
merged 3 commits into from
Nov 8, 2023

Conversation

lucasssvaz
Copy link
Collaborator

@lucasssvaz lucasssvaz commented Oct 26, 2023

Description of Change

This PR aims to improve the Peripheral Manager log messages to help debugging processes.

@lucasssvaz
Copy link
Collaborator Author

@SuGlider Please check if you want any other log messages for the PeriMan.

@lucasssvaz lucasssvaz marked this pull request as draft October 26, 2023 14:15
@lucasssvaz lucasssvaz self-assigned this Oct 27, 2023
@lucasssvaz lucasssvaz added the Area: Peripherals API Relates to peripheral's APIs. label Oct 27, 2023
@lucasssvaz
Copy link
Collaborator Author

Further investigation shows that the CPU hangs waiting for an interrupt. The following sketch with debug level set to verbose produces this misbehavior (tested on ESP32-S3-DevKitC):

void setup() {
  Serial.begin(115200);
  while(!Serial) { delay(10); }

  pinMode(SOC_RX0, OUTPUT);
  pinMode(SOC_TX0, INPUT);

  delay(100);
  Serial.println("test: This should not be printed");
  Serial.flush();

  Serial.setPins(SOC_RX0, SOC_TX0);
  delay(100);
  Serial.println("test: This should be printed");
  Serial.flush();
}

void loop() {
#ifdef RGB_BUILTIN
  neopixelWrite(RGB_BUILTIN,4,0,0); // Red
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,4,0); // Green
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,4); // Blue
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
  delay(1000);
#endif
}

The backtrace of when the processor hangs:

#0  0x4037972e in esp_cpu_wait_for_intr () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/cpu.c:121
#1  0x4200c6d8 in esp_vApplicationIdleHook () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/freertos_hooks.c:59
#2  0x4037c456 in prvIdleTask (pvParameters=<optimized out>) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4327
(gdb) 

@SuGlider Might this be related to the issue you are seeing in #8809 ?

@me-no-dev
Copy link
Member

maybe the fact that you are modifying the default UART pins, without deinitializing the UART first, is the problem :)

@SuGlider
Copy link
Collaborator

these issues that Lucas has reported are solved with #8820 - including hanging while using logging.

@SuGlider
Copy link
Collaborator

SuGlider commented Oct 31, 2023

Further investigation shows that the CPU hangs waiting for an interrupt. The following sketch with debug level set to verbose produces this misbehavior (tested on ESP32-S3-DevKitC):

void setup() {
  Serial.begin(115200);
  while(!Serial) { delay(10); }

  pinMode(SOC_RX0, OUTPUT);
  pinMode(SOC_TX0, INPUT);

  delay(100);
  Serial.println("test: This should not be printed");
  Serial.flush();

  Serial.setPins(SOC_RX0, SOC_TX0);
  delay(100);
  Serial.println("test: This should be printed");
  Serial.flush();
}

void loop() {
#ifdef RGB_BUILTIN
  neopixelWrite(RGB_BUILTIN,4,0,0); // Red
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,4,0); // Green
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,4); // Blue
  delay(1000);
  neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
  delay(1000);
#endif
}

The backtrace of when the processor hangs:

#0  0x4037972e in esp_cpu_wait_for_intr () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_hw_support/cpu.c:121
#1  0x4200c6d8 in esp_vApplicationIdleHook () at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/freertos_hooks.c:59
#2  0x4037c456 in prvIdleTask (pvParameters=<optimized out>) at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:4327
(gdb) 

@SuGlider Might this be related to the issue you are seeing in #8809 ?

The issue with verbose was related to dead lock. Solved with #8820
Teste this sketch with and without logging - C6 and S3. All fine now.

@lucasssvaz lucasssvaz marked this pull request as ready for review October 31, 2023 22:09
Copy link
Member

@P-R-O-C-H-Y P-R-O-C-H-Y left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@me-no-dev me-no-dev merged commit 322ba37 into espressif:master Nov 8, 2023
37 checks passed
JAndrassy pushed a commit to JAndrassy/arduino-esp32 that referenced this pull request Nov 9, 2023
* Improve log messages

* Add name function

---------

Co-authored-by: Jan Procházka <90197375+P-R-O-C-H-Y@users.noreply.github.com>
@lucasssvaz lucasssvaz deleted the feature/periman_debug branch March 19, 2024 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Peripherals API Relates to peripheral's APIs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants