Error using Print statement inside interrupt

kartikkman
Posts: 15
Joined: Wed Jul 19, 2017 11:27 am

Error using Print statement inside interrupt

Postby kartikkman » Thu Jan 04, 2018 10:58 am

Hi , first of all thanks for forum users for helping me out for the problems up till now .
Today , I encountered issue while using interrupt , that when I write LOGS ( ESP_LOGI ) inside the interrupt , then I get the error .
I wanted to know whether it occurs because interrupt handler function should execute at a minimum time ?? Or is it some my fault in programming ??

Here is my Code :

Code: Select all

#include<stdio.h>
#include"freertos/FreeRTOS.h"
#include"freertos/task.h"
#include"esp_system.h"
#include"driver/uart.h"
#include"freertos/semphr.h"
#include"esp_log.h"
#include"driver/timer.h"
 
#define MAIN_TAG "MAIN"
static intr_handle_t s_timer_handle;

static void interrupt_time(void *args)
{

    TIMERG0.int_clr_timers.t0 = 1 ; //This is for clearing the Interrupt that has been triggerd by the timer . 
    //Now writing the Code below for execution at the alarm 
    TIMERG0.hw_timer[0].config.alarm_en = 1;
    ESP_LOGI(MAIN_TAG, " Alarm has been raised ");
}


void initialise_interrupt(uint64_t time)
{

            //First Prepare the Configuration for the Timer 
        //: that is using its Structuture , then passing that Structure to the Timer Init funciton

        timer_config_t config = {

        .alarm_en = 1,//For setting the Alarm , as soon as the Value of Timer reaches particular value , it triggers interrrupt
        .counter_en = 0,//This setting makes timer start as soons as it is configured 
        .intr_type = TIMER_INTR_LEVEL,//Don't Know wha this is for 
        .counter_dir = TIMER_COUNT_UP,
        .auto_reload = 1, //Reloads the Timer automatically after interrupt 
        .divider = 80 , // Right now 1 uSec for 1 tick ( Simplyfing the calculation )

        };


        ESP_ERROR_CHECK(timer_init(TIMER_GROUP_0,TIMER_0,&config));
        timer_set_counter_value(TIMER_GROUP_0, TIMER_0, 0);//This value is used when Timer auto reloads , it will be loaded to this value 
        timer_set_alarm_value(TIMER_GROUP_0 , TIMER_0,time);//Value of 60 * 10^6 has been set as delay 
        timer_enable_intr(TIMER_GROUP_0,TIMER_0);
        ESP_ERROR_CHECK(timer_isr_register(TIMER_GROUP_0,TIMER_0,&interrupt_time, NULL , 0 , &s_timer_handle));//Registering the Interrrupt for the timer , this is called when the alarm is raised . 
        timer_start(TIMER_GROUP_0,TIMER_0);




}


void null_task(void *pvParam)
{
    while(1)
    {
        ESP_LOGI(MAIN_TAG, "This is a null Tag ");

        vTaskDelay(1000/portTICK_PERIOD_MS);
    }

}



void app_main()
{

    xTaskCreate(&null_task,"Printing VOID Logs ",2048 , NULL , 3, NULL);
    initialise_interrupt(5000000);

}

Here is the screenshot of my output :
Attachments
itnerrupt_error.png
itnerrupt_error.png (127.38 KiB) Viewed 8390 times


Who is online

Users browsing this forum: kaxx1975, markkuk and 142 guests