|
|
View previous topic :: View next topic |
Author |
Message |
Lemosek
Joined: 15 Oct 2011 Posts: 36
|
RTOS and CAN 18f2580 |
Posted: Tue Mar 20, 2012 11:09 am |
|
|
Hello, I have strange problem. I write a simple code:
Code: |
#include <18F2580.h>
#fuses HS, NOPROTECT, PUT, BROWNOUT, NOWDT, NOLVP
#use delay(clock=20M)
#use rtos(timer=1,minor_cycle=20ms)
#include <can-18F4580.c> // Use correct driver
#include "button.c"
//definicje ID CAN
#define BOARD_ID_LEDMATRIX 30
#define BOARD_ID_MAIN_LEDMATRIX 31
//*************** Global variables ****************
int8 sem;
struct rx_stat rxstat;
int32 rx_id;
int32 tx_id;
int8 rx_len;
volatile int8 buffer_rcv[8];
int8 buffer_tx[8];
//*************************** TASK *****************************
#task(rate=200ms,max=20ms)
void Led_button_task ( );
#task(rate=1000ms,max=20ms)
void Button_task ( ); // odczyt stanu przycisków co 10ms
//======== button task =====//
void Button_task(){
can_putd(BOARD_ID_MAIN_LEDMATRIX, buffer_tx, 1, 1, 1, 0);
}
void Led_button_task()
{
}
//======================================
void main()
{
//CAN
can_init();
sem=1;
rtos_run();
} |
Compiler warning:
Warning 216 Interrupts disabled during call to prevent re- entrancy: (can_set_id)
Why I have this warning??
CCS PCH C Compiler, Version 4.128.
In past I write some code with CAN bus and RTOS for dsPIC30f6010A and I also use Can_putd function in tasks and don't have this warning.
Best regards
R.L. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 20, 2012 3:07 pm |
|
|
Both can_putd() and can_init() call the can_set_id() function.
I don't have the CCS RTOS, but apparently tasks are called from within
an interrupt routine.
Code: |
void Button_task(){
can_putd(BOARD_ID_MAIN_LEDMATRIX, buffer_tx, 1, 1, 1, 0);
}
|
That would explain why you get the "interrupts disabled" warning.
Quote: |
In past I write some code with CAN bus and RTOS for dsPIC30f6010A and
I also use Can_putd function in tasks and don't have this warning.
|
I don't have the PCD compiler, but it's possible that it allows nested
interrupts and re-entrant routines. I have no experience with dsPICs
or PCD. But that could explain the difference. Or, it's also possible
that you had Warnings disabled when you used the PCD compiler. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|