Pumpkin, Inc.

Pumpkin User Forums

A question concerning delays.

For issues specific to TI's MSP430 line of ultra-low-power microcontrollers, including compilers (e.g. Quadravox AQ430), IDEs (e.g. IAR Embedded Workbench) and development tools (e.g. TI MSP-FET430 Flash Emulation Tool).

A question concerning delays.

Postby ces » Sun Jul 30, 2006 9:38 am

Situation: I have been having problems with the reliability of my delays within Salvo. In order to solve this I added a very simple LED switching task based on the code provided in Project 1 for the CubeSat Kit to my project. I had hoped that this would let me find my error and resolve it, but unfortunatly that has not been the case.

Problem: When I step through the code it consistently switches the LED on and off for an indefinite amount of time. However, if I turn off my break points and let the code run at full speed it will complete 1 to 3 calls to my task and then idle indefinitely. What error on my part could be causing my code to operate correctly while stepping through it via a debugger, but fail to operate when allowed to execute at full speed?

I have included links to all of the relevant source code below:

salvocfg.h -> here
main.h -> here
main.c -> here
isr.h -> here
isr.c -> here

This code is part of a much larger project, but in trying to isolate this problem I have commented out or removed much of the other code.

Edit 1: Fixed the links.
Edit 2: Fixed some grammar.
Edit 3: Fixed more grammar.

[This message has been edited by ces (edited July 30, 2006).]

[This message has been edited by ces (edited July 30, 2006).]

[This message has been edited by ces (edited July 30, 2006).]

ces
 
Posts: 4
Joined: Thu Jun 29, 2006 11:00 pm
Location: Raleigh, NC

Re: A question concerning delays.

Postby ces » Mon Jul 31, 2006 6:58 am

Thank you, with the change you suggested and the removal of any references to the ISR my code works correctly. I'll see about finding where my error was in my interrupt code.

Thanks again,

Chuck

ces
 
Posts: 4
Joined: Thu Jun 29, 2006 11:00 pm
Location: Raleigh, NC

Re: A question concerning delays.

Postby aek » Mon Jul 31, 2006 11:31 am

I'll take a look at your code later ... but in general, problems with delays are due to the user incorrectly coding the ISR that calls OSTimer().

A quick way to prove / disprove this is to stop calling OSTimer() from an ISR and instead call it from main:

code:

int i = 500;
...
while (1)
{
if (--i == 0)
{
i = 500;
OSTimer();
}
OSSched();
}

While the time accuracy of such a scheme is not that of using an ISR, it avoids all interrupt-related issues and your delays will work, with a slight loss of accuracy. Try this and see what happens.

------------------

[This message has been edited by aek (edited July 31, 2006).]

-------
aek
aek
 
Posts: 1888
Joined: Sat Aug 26, 2000 11:00 pm


Return to TI's MSP430

Who is online

Users browsing this forum: No registered users and 1 guest

cron