Skip to content

Ticker::active() crashes when it call before attach_ms() #6511

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

Closed
1 task done
GitNik1 opened this issue Mar 31, 2022 · 1 comment
Closed
1 task done

Ticker::active() crashes when it call before attach_ms() #6511

GitNik1 opened this issue Mar 31, 2022 · 1 comment

Comments

@GitNik1
Copy link
Contributor

GitNik1 commented Mar 31, 2022

Board

ESP32 Dev Module

Device Description

Custom

Hardware Configuration

Version

latest master

IDE Name

VisualMicro

Operating System

Windows 10

Flash frequency

80MHz

PSRAM enabled

no

Upload speed

115200

Description

_timer in Ticker lib is null before you call a attach methode and crashes in esp_timer_is_active(_timer);

Sketch

#include <Arduino.h>
#include <Ticker.h>

// attach a LED to GPIO 21
#define LED_PIN 2

Ticker tickerSetHigh;
Ticker tickerSetLow;

void setPin(int state) {
	digitalWrite(LED_PIN, state);
}

void setup() {
	pinMode(LED_PIN, OUTPUT);
	digitalWrite(1, LOW);

	bool isActive = tickerSetLow.active();
	// every 25 ms, call setPin(0) 
	tickerSetLow.attach_ms(25, setPin, 0);

	// every 26 ms, call setPin(1)
	tickerSetHigh.attach_ms(26, setPin, 1);
}

void loop() {

}

Debug Message

rst:0xc (SW_CPU_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:12812
load:0x40080400,len:3032
entry 0x400805e4
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x400e966b  PS      : 0x00060030  A0      : 0x800d0f18  A1      : 0x3ffb27c0  
A2      : 0x00000000  A3      : 0x00000000  A4      : 0x00000000  A5      : 0x00000004  
A6      : 0x00000028  A7      : 0x00000001  A8      : 0x00000002  A9      : 0x3ff44000  
A10     : 0x0000001f  A11     : 0x00000001  A12     : 0x00000001  A13     : 0x00000020  
A14     : 0x3ffc156c  A15     : 0x3ffc156c  SAR     : 0x0000001f  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000  


Backtrace:0x400e9668:0x3ffb27c00x400d0f15:0x3ffb27e0 0x400d0e4c:0x3ffb2800 0x400d1252:0x3ffb2820

Other Steps to Reproduce

No response

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.
@GitNik1 GitNik1 added the Status: Awaiting triage Issue is waiting for triage label Mar 31, 2022
GitNik1 added a commit to GitNik1/arduino-esp32 that referenced this issue Mar 31, 2022
@VojtechBartoska VojtechBartoska added Status: Pending and removed Status: Awaiting triage Issue is waiting for triage labels Apr 1, 2022
@VojtechBartoska
Copy link
Contributor

Hello @GitNik1, thanks for issue and proposed PR. We will review it soon. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants