Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

The problem about interrupt on HT32 that a chip like STM32

Posted by guoguiwu on February 19, 2014

I transplant FreeRTOS to the HT32 that a chip like STM32. I want use UART interrupt to receive some data, but when the routine run to the UART interrupt routine it can not jump out the interrupt routine ,it just run the interrupt routine over and over. What's the problem? That a part of my config in FreeRTOS.h:

define configKERNELINTERRUPTPRIORITY 255
define configMAXSYSCALLINTERRUPT_PRIORITY 191
define configUSE_MUTEXES 1
define configUSECOUNTINGSEMAPHORES 1

And a part of my code: void NVICConfiguration(void) { NVICSetVectorTable(NVICVECTTABLEFLASH, 0x0);
NVICSetPriorityGrouping(NVICPRIORITYGROUP3);// Preemption: 4 bits / Subpriority: 0 bits NVICSetPriority(USART1IRQn, NVICEncodePriority(NVICPRIORITYGROUP3, 12, 0)); }

xSemaphoreHandle xhighSemaphore; void vultrasonicTask(void *pvParameters) { char i=0; char HDATA=0; char LDATA=0; u16 high; xhighSemaphore = xSemaphoreCreateCounting( 10, 0 ); while(1) { USARTSendData(USART1,0x55 ); xSemaphoreTake( xhighSemaphore, 500 / portTICKRATEMS ); if(i==0) { HDATA=USARTReceiveData(USART1); i++; return; } if(i==1) { LDATA=USARTReceiveData(USART1); i--; high=(HDATA<<8)+LDATA; printf("high=%drn",high); } vTaskDelay( 1000 / portTICKRATEMS ); }

}

void USART1IRQHandler(void) { static portBASETYPE xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; xSemaphoreGiveFromISR( xhighSemaphore, &xHigherPriorityTaskWoken ); portENDSWITCHINGISR(xHigherPriorityTaskWoken ); }


The problem about interrupt on HT32 that a chip like STM32

Posted by davedoors on February 19, 2014

Presumably that is because you are not clearing the interrupt so it is immediately retaken as soon as you exit the handler. What makes you think the problem is related to FreeRTOS?


The problem about interrupt on HT32 that a chip like STM32

Posted by richard_damon on February 19, 2014

Generally the ISR needs to do the immediate actions that trigger the interrupt. That generally includes for a serial port getting the character and putting it some where. (This doesn't apply for using DMA, but then when you use DMA, you don't get character ready interrupts, you get DMA complete interrupts).

The ISR could put the character in a queue if the data rate is somewhat slow. For faster channels it should build up a "message" and on receipt of a complete message signal a task to process it.


The problem about interrupt on HT32 that a chip like STM32

Posted by guoguiwu on February 20, 2014

If I did not use the FreeRTOS API in the interrupt routine, it display normal. But when I use the FreeRTOS API in the interrupt routine the problem came. So I think it may related to FreeRTOS.


The problem about interrupt on HT32 that a chip like STM32

Posted by guoguiwu on February 20, 2014

Thank you very much! I solved the problem in your reminder!


The problem about interrupt on HT32 that a chip like STM32

Posted by guoguiwu on February 20, 2014

I had solved the problem. Proof by facts, the problem is not related to FreeRTOS. It is because i didn't get the character and put it some where. Thank you for you answer.


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




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists