Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

FreeRTOS task not run when interrupt timer active on STM32F4 Discovery

Posted by ramawidi on June 7, 2017

Hi, I want to combine the interrupt timer on STM32F4 Discovery with FreeRTOS task. But unfortunatelly the task is not executed, but when I disable my interrupt timer the task is works well. Does anyone know why this is happend?

Regards Rama


FreeRTOS task not run when interrupt timer active on STM32F4 Discovery

Posted by heinbali01 on June 7, 2017

Would you mind to show some of the source code? Both of the "interrupt timer", as well as the task that doesn't run


FreeRTOS task not run when interrupt timer active on STM32F4 Discovery

Posted by ramawidi on June 8, 2017

Hi there, here is the code for my Interrupt Timer

~~~ void TIM2Config(){ TIMTimeBaseInitTypeDef TIMTimeBaseStructure; RCCPCLK1Config(RCCHCLKDiv16); RCCAPB1PeriphClockCmd(RCCAPB1PeriphTIM2,ENABLE); TIMTimeBaseStructure.TIMPrescaler = 42000-1; TIMTimeBaseStructure.TIMCounterMode = TIMCounterModeUp; TIMTimeBaseStructure.TIMPeriod = 200-1; TIMTimeBaseStructure.TIMClockDivision = TIMCKDDIV1; TIMTimeBaseStructure.TIMRepetitionCounter = 0; TIMTimeBaseInit(TIM2,&TIMTimeBaseStructure); TIMCmd(TIM2,ENABLE); }

void TIMITEnable(){ TIMITConfig(TIM2,TIMITUpdate, ENABLE); } void NVICConfig(){ NVICInitTypeDef NVICInitStrurture; NVICPriorityGroupConfig(NVICPriorityGroup0); NVICInitStrurture.NVICIRQChannel = TIM2IRQn; NVICInitStrurture.NVICIRQChannelPreemptionPriority = 0x00; NVICInitStrurture.NVICIRQChannelSubPriority = 0x00; NVICInitStrurture.NVICIRQChannelCmd =ENABLE; NVICInit(&NVICInitStrurture); }

int nInterrupt=0,counter; char buffer[32]; char buftmp[32]; void TIM2IRQHandler(){ if(TIMGetITStatus(TIM2,TIMITUpdate)!=RESET){ TIMClearITPendingBit(TIM2,TIMITUpdate); //counter=TIMGetCounter(TIM6); nInterrupt++; //sprintf(buffer,"rke-%3dn",nInterrupt); //USARTputs(buffer); sprintf(buftmp,"%dn",tmp); USARTputs(buf_tmp); tamp = 0; } } ~~~

And I have 2 Task, 1 task for simple print and 1 task for networking (using LwIP)

~~~ void testprint(void) { TickTypet waketime,tamp1,tamp2; const uint32t period = 100; char buff[32];

wake_time = xTaskGetTickCount();
while(1)
{
	USART_puts("aaaaaaaaaaa ");
	//vTaskDelay(1000);
	delay_dw(500);

	tamp2 = xTaskGetTickCount();
	sprintf(buff,"Tick2 = %u\n",tamp2);

	USART_puts(buff);
	vTaskDelayUntil(&wake_time,period);
}

}

void echotcp() { int c1,c2; char clock[32]; tamp = 0; while(1) { if(ETHCheckFrameReceived()) { cyclestart(); c1 = getCycles(); LwIPPktHandle(); c2 = getCycles(); cyclestop();

			tamp+= c2 - c1;
			GPIO_SetBits(GPIOD,GPIO_Pin_12);
		}
		else
		{
			GPIO_ResetBits(GPIOD,GPIO_Pin_12);
			LwIP_Periodic_Handle(LocalTime);
		}
}

} ~~~


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner