use printf in isr,the cpu will restart
-
- Posts: 10
- Joined: Mon Apr 10, 2023 3:52 am
use printf in isr,the cpu will restart
how to use printf in isr savely
Re: use printf in isr,the cpu will restart
There are two main problems with using printf in an ISR: amount of stack consumed, and amount of processing time taken. ISRs usually have a limited amount of stack space allocated, and usually have limited time to perform its task.
You can usually configure your ISR stack space to be larger and that might enable you to use printf. If the real time for printf is the issue, then you'll need to use a simpler, faster means of printing without general formatting libraries. Using simpler methods for printing will also help solve the stack size issue.
You can usually configure your ISR stack space to be larger and that might enable you to use printf. If the real time for printf is the issue, then you'll need to use a simpler, faster means of printing without general formatting libraries. Using simpler methods for printing will also help solve the stack size issue.
-
- Posts: 9757
- Joined: Thu Nov 26, 2015 4:08 am
Re: use printf in isr,the cpu will restart
Also, printf is a blocking function. You can't use blocking functions in an isr. Either use esp_rom_printf/ets_printf or ESP_LOG_EARLY.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 342 guests