CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

CAN Receive interrupt problem - needs RXB0CON.rxful = FALSE

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
seidleroni



Joined: 08 Sep 2008
Posts: 21

View user's profile Send private message

CAN Receive interrupt problem - needs RXB0CON.rxful = FALSE
PostPosted: Mon Feb 23, 2009 4:26 pm     Reply with quote

Hi everyone,

I am having an odd issue with CAN. The CAN interrupts work and my code works much of the time. However, when I send a lot of messages to CAN, occasionally I find that the CAN receive interrupt no longer works. For instance, I have a bit of code that toggles the LED on a CAN interrupt. This does not execute once the CAN receive interrupt has "locked up", and the LED wont blink even when I send more CAN messages (slowly, once per second or so...)

Code:
#INT_CANRX0
#SEPARATE
void CANRX0isr(void)
{     
   output_bit(PIN_LED, !input(PIN_LED));   // Toggle LED state every second   
   ParseCAN();
   CAN_INT_RXB0IF=FALSE;
   RXB0CON.rxful = FALSE;
}

void ParseCAN()
{

   int32 id32;
   int data8[8];
   int length;
   int error;
   int i; 
   
   can_getd(id32,data8,length,error);

   cviRXCAN[nPacketReceived].CANid = id32;   
   cviRXCAN[nPacketReceived].CANlength = length;      
      
   for (i = 0; i < length; i++)
      cviRXCAN[nPacketReceived].CANdata[i] = data8[i];   
      
   nPacketReceived++;
   if (nPacketReceived == CAN_RX_BUFFER_SIZE)
      nPacketReceived = 0;
               
   fCANRX = TRUE;      
}




However, once I added the line above (RXB0CON.rxful = FALSE), the CAN never 'locked up' again. But looking at the "can_getd()" function from CCS, this should already be turning off RXB0CON.rxful = 0, so me doing it again shouldnt have an effect. (Note: the can_getd() is called in the 'ParseCAN' function called above)

Any ideas on what could be happening here to cause the can_getd() function to not reset the RXB0CON.rxful value?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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