View previous topic :: View next topic |
Author |
Message |
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
RTOS not working |
Posted: Thu Jul 23, 2009 5:28 pm |
|
|
I am using the PIC24HJ12GP202 and cannot make the rtos run.
the tasks are not doing anything.
If I uncomment the output_toggle and/or the printf statements in main, the pin is toggling and the terminal shows the serial output on the screen.
However, I would expect to see the printf and toggle statement executed once but it repeats forever like it would in a while(1) loop.
During simulation (on the chip) I see that the program goes to the rtos_run() then task1 and back to main and so on.
I did add setup_timer1 and enable_interrupts but it didn't make a difference.
If I don't use the rtos and set the toggle in the timer interrupt it will toggle the pin.
I went back from my application to the minimal example from CCS (see below) but it doesn't work either.
Here the example program modified for the PIC24. The fuses are set in main.h.
Code: |
#include "C:\xxxxx\software\test3\main.h"
#use fast_io(b)
#use delay(clock=32M,internal=8M)
#use rs232(UART1,baud=9600,parity=N,bits=8, xmit = PIN_B3)
#use rtos(timer=1,minor_cycle=10ms)
#task(rate=100ms,max=5ms)
void The_first_rtos_task ( )
{
output_low(Dig_out1);
printf ("1\n\r") ;
rtos_terminate () ;
}
#task(rate=100ms,max=5ms)
VOID The_second_rtos_task ( )
{
output_high(Dig_out1);
printf ("\t2 ! \n\r") ;
}
#task(rate=100ms,max=5ms)
VOID The_third_rtos_task ( )
{
printf ("\t\t3\n\r") ;
}
// main is still the entry point FOR the program
VOID main ( )
{
setup_timer1 (TMR_INTERNAL);
set_tris_b (0x5ff4) ;
set_tris_a (0x0f) ;
enable_interrupts (INT_TIMER1) ;
// output_toggle (Dig_out1);
// printf("\t\t3\n\r");
delay_us(10);
rtos_run ();
} |
I tried the examples from the Doggan Ibrahim book with the same results.
Any help would be appreciated.
Thanks.
Rock. _________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Guest
|
|
Posted: Fri Jul 24, 2009 11:18 am |
|
|
The first problem I notice is the
Code: | rtos_terminate () ; |
Inside your first task... this function will terminate the rtos, as the name says.
I don't remember if there are any need to set the timer 1, because I think that the compiler already do this when you defined the rtos parameters:
Code: | #use rtos(timer=1,minor_cycle=10ms) |
|
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
rtos not working |
Posted: Fri Jul 24, 2009 11:38 am |
|
|
Sorry, I forgot to remove that line. I was trying different things in my desperation and forgot to remove the line before posting.
I did ask CCS tech support and hope to get an answer today. If I do I'll post it. _________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
rtos not working |
Posted: Fri Jul 24, 2009 3:05 pm |
|
|
I received a confirmation from CCS support that the processor is resetting. They are going to look into it but didn't say how long it will take.
I am going to try with an 18F8490 to see if I have the same problem.
Anonymous wrote: | The first problem I notice is the
Code: | rtos_terminate () ; |
Inside your first task... this function will terminate the rtos, as the name says.
I don't remember if there are any need to set the timer 1, because I think that the compiler already do this when you defined the rtos parameters:
Code: | #use rtos(timer=1,minor_cycle=10ms) |
|
_________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
RTOS NOT WORKING |
Posted: Fri Jul 24, 2009 4:05 pm |
|
|
I did try the same program on a 18F8490 board and it works.
What could make a PIC24 reset while it doesn't with the 18F?
Is there a bug in the watch dog timer that prevent it to be disabled?
An error interrupt?
Any suggestions?
Thanks _________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
Re: RTOS NOT WORKING |
Posted: Fri Jul 24, 2009 6:56 pm |
|
|
here is the answer from CCS:
This message is a reply to CCS e-mail id: 9G5689
Hey,
RTOS is not supported for PCD. Is there somewhere on our website that documents that it is? Thanks.
CCS Tech Support
Neither does it say it doesn't, at least I didn't find it. Too bad the code is not available.
Thanks to everybody that answered.
Rocky wrote: | I did try the same program on a 18F8490 board and it works.
What could make a PIC24 reset while it doesn't with the 18F?
Is there a bug in the watch dog timer that prevent it to be disabled?
An error interrupt?
Any suggestions?
Thanks |
_________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
RTOS not working |
Posted: Sat Jul 25, 2009 10:09 am |
|
|
Thank you PCM I will.
It is a pity because it is working really well on the 18F. At least for this project.
Again, I'll post any news I get on this subject.
_________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
rtos not working |
Posted: Sat Jul 25, 2009 10:16 am |
|
|
PCM in fact I should have think about that too as I have been consulting the manual.
I did notify CCS and I am curious to see their answer.
_________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
Rocky
Joined: 26 Apr 2009 Posts: 22 Location: USA
|
Re: rtos not working |
Posted: Sat Aug 15, 2009 6:31 pm |
|
|
After several emails, the last one copying the CEO of the company I received this answer on 8/3/09:
It seems there is a bug in the 24 bit RTOS even though it is our intention for it to work. I will make sure someone debugs the problem and we will let you know when it is fixed.
Rocky wrote: | PCM in fact I should have think about that too as I have been consulting the manual.
I did notify CCS and I am curious to see their answer.
|
_________________ PERSEVERANCE IS THE KEY TO SUCCESS |
|
|
|