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

STR9 - Timer interrupt problem

Posted by gorlash3 on November 14, 2013

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">

Okay, I'm using Stefano's STR9 package, which uses the ST libraries. 
The only changes that I made to his package, was to replace his hardware-initialization code with our hw init code, which is working on the board that I want to use FreeRTOS on.  I compile now with no warnings, and main() is running successfully.
I can access the LEDs on our board, and am using them to debug code execution.

However, I'm having problems getting the Timer to work, and of course without that, the RTOS isn't going to run!!

Looking first at Stephano's main timer (TIM2):

Try 1: I found that when using his timer-init function, the TIM2 ISR never got called at all!! 

Try 2: Since I had a working timer-init function in our existing code, I copied that init function over and modified it to set up TIM2.  In this case, the TIM2 ISR gets called exactly ONCE, but even the command to clear the interrupt flag is getting executed, the TIM2 ISR never gets called subsequently.

Try 3: I then copied over my TIM0 setup function and ISR, and I saw exactly the same thing as TIM2 - my TIM0 ISR gets called ONCE, and never gets called again.  This exact code is running fine in our non-RTOS firmware.

What could be interfering with the running of the timers??

Dan Miller





This email is free from viruses and malware because avast! Antivirus protection is active.



STR9 - Timer interrupt problem

Posted by richardbarry on November 14, 2013

Are you saying the timer does not run as expected in main() before you have made any FreeRTOS API calls? If so I'm not sure anything can be interfering. If you have made FreeRTOS API calls then, depending on the call, you may find interrupts have been disabled. That is done to ensure no interrupts attempt to use the kernel before the kernel has been started. Interrupts are automatically re-enabled when the kernel starts.

Some start up routines (the code that executes before main() is called) will perform some hardware initialisation, so it is possible you will get different behaviour when switching between different hardware setup routines. You may even find that Stefano's original project contains a debugger script that has the debugger perform some hardware initialisation too.

Regards.


STR9 - Timer interrupt problem

Posted by gorlash3 on November 14, 2013

BTW, just as a sanity check (since I'm new to FreeRTOS, and RTOS in general), I am assuming that I need the timer running in order for task switching to work; is this correct?? Or are they independent?

Oddly enough, I've noticed that the web page is displaying, which implies that the Ethernet task at least is running, even though the timer doesn't seem to be running.


STR9 - Timer interrupt problem

Posted by edwards3 on November 14, 2013

On the ARM9 yield uses SWI instructions and ticks user timer interrupts, so the two are independent of each other.


STR9 - Timer interrupt problem

Posted by gorlash3 on November 14, 2013

Okay, (I think) I understand what is going on... although I am starting the LED-flashing task ( vStartLEDFlashTasks() ), and therefore presumably it is running, that task calls vTaskDelayUntil(), which presumably won't return if the timer tick is not running...

Well, hopefully Stefano will come up with something; he already replied to my email last night, but said he'd have to look at the old code, which he hasn't looked at in a few years!!


STR9 - Timer interrupt problem

Posted by gorlash3 on November 14, 2013

Actually, there's more going on than just the timer... I put a turnonLED(LED_GRN) call at the start of the LED task, and it never gets executed. So apparently, even though xTaskCreate( vLEDFlashTask, ...) is getting called, the task is never getting executed...

BTW, I went back and checked the return values for xTaskCreate(), and it is returning pdPASS for both LED tasks...


[ 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