Home/Support/Support Forum/indefinitely in the function waitmills to activate a timer
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

indefinitely in the function waitmills to activate a timer

0 votes
Hello,
I have a problem; I have done, by example "HTTP Managed Server Sample", a program that serves a web page for the control of a system domotic. Communication is through the serial port, and the GUI is the website. I make requests through a form and I update the site with changes in the system domotic.
My problem is: when is underway now and again when the program goes into a loop that never ends, and stays there all the time (It occurs when a timer active retransmit frames for the wrong serial port
).
I have two threads, one is for send and receiver data from serial device (It's not really a thread created by me, I take the function “void applicationStart (void)” file root.c enter an infinite loop to read and write the serial port). The received data are stored in a queue, and data were sent in another queue before being sent. The second thread is to extract data from the queue which has received the serial port. To put in the queue to send the data do not have a thread, I do so since the function where recieve forms html.
At debug kit with DIGI ESP for NET + OS, and so in the following routine:

File: nawait.c
.
.
.
* This is the delay loop. The dummyReturnValue is there so that the compiler
* does not optimize the loop away.
*/
for (iteration = 0; iteration < numberIterations; iteration++)
{
dummyReturnValue += iteration + cyclesToExecute;
}
}
.
.
.


Timer:

estado = tx_timer_create(&tiempoRetransmision,"tiempoRetransmision", retransmision, 0, 200, 200,TX_NO_ACTIVATE );

if (estado!=TX_SUCCESS)
{
printf("Error, al crear el timer tiempoRetransmision\n");
}

My question is: what reasons there are for it to enter into this loop delay?


Thank you for your attention and sorry for my English.
asked Jul 16, 2008 in NET+OS by jagullo_at_ineli.com New to the Community (3 points)
recategorized Dec 18, 2013 by tuxembb

Please log in or register to answer this question.

4 Answers

0 votes
The main reason that I am aware of that a program would call waitmills is when you have entered an exception handler. So to start diagnosis, you might do the following: In file INIT.s (arm7) or INIT.arm (arm9) there are approximatley 1/2 dozen exception handlers. Abort_Handler, Address_Error_Handler, Undefined_Handler and a few others. BTW, INIT.* are found in \src\bsp\init\<arm7|arm9>

Set breakpoints at each of these exception handlers and see if you end up in any of them. If the answer is yes, then something in your code is doing something bad. You'll need to investigate this.

Also ensure that you have pulled down ALL of the updates available for your release of NET+OS from the Digi web site (www.digi.com). follow the support tab through your H/W device, through patches to your revision of NET+OS.
answered Jul 16, 2008 by sparkys_dad Community Contributor (99 points)
0 votes
Sorry, but when you open the file INIT.s not let me put a breakpoint. In this file will disappear along the left side, where he was placed with the breakpoint clicking the mouse.
There another way to do that, my environment is the eclipse.
JumpStart Development Environment for NET + OS 7 with Digi ESP. Specifically NET + OS 7.3

thank you for your prompt response.
answered Jul 17, 2008 by jagullo_at_ineli.com New to the Community (3 points)
0 votes
Try the following:

After you have built your application but before debugging, open the file in which you want to set a break point, in your case INIT.s. Also ensure you are in the debug prespective. If you have more than one tree, make sure you are editing the correct file.

Place your cursor at the line where you want to break. In my case, the first line of procedure Abort_Handler

Now for the trick, click run\toggle line breakpoint

When you are done, in the debug perspective, in the breakpoints tab, you should see your breakpoint set (shows a line number in the file.

To test this I did the following:

Create a new project, as basic as possible
Edit root.c as follows:

unsigned long anAddress = 0xFFFFFFFF;
unsigned long * aPointer = NULL;
unsigned long aNumber = 0;

aPointer = anAddress;
aNumber = *aPointer;
printf("The contents are %lu\n", aNumber);

Since aPointer is a nonsense address, you should get an Abort_Handler exception. You should break at the line number you set.

Of course all this assumes you are experiencing an exception. After hitting the breakpoint, you'll need to work backwards to figure out who is doing something bad.
answered Jul 17, 2008 by sparkys_dad Community Contributor (99 points)
0 votes
thank you very much,
occurs just as you say, to activate the timer (after 30, 40 seconds) stops on the Abort_handler and then enters the waitmills. I've changed my code, as, the timer so active when I arrived a plot wrong, and re-activate without desctivarlo (repeating this with each mistake) and end the timer was crazy again.
answered Jul 18, 2008 by jagullo_at_ineli.com New to the Community (3 points)
...