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

Lock out of CAN reception

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



Joined: 27 Sep 2007
Posts: 4

View user's profile Send private message

Lock out of CAN reception
PostPosted: Tue Oct 02, 2007 5:04 am     Reply with quote

I am using 18F458 Rev C0. The board communicates over CAN BUS. It is working very fine for a uncertain time, than it stops reception. I used ICD to debug the board. When this happens, I see that frame is accepted however, contents of the frame buffer does not reflect the frame that is sent. I searched errata for that. Certainly, silicon errata for rev C0 has this error:

Quote:

An incoming CAN message may not be saved properly to a CAN receive buffer if one of the following conditions is met:
1. Bank 15 is selected and the firmware attempts to read RXB0 or RXB1 registers while a CAN message reception is in progress.
2. Bank 15 is selected and an instruction is executed whose lower 8 bits match with one of the CAN receive buffer addresses (RXBn addresses in the range of 0xF61 to 0xF6E and 0xF51 to 0xF5D) while a CAN message reception is in progress. Some of the instruction examples are:
• 0xFF68 (NOP)
• 0xEE68 (first half of GOTO 0xD0)
• 0x0E6A (MOVLW 0x6A)
• 0x6055 (MOVF 0xF66, W)
Other instruction combinations exist.
3. The firmware attempts to access GPRs (General Purpose Register addresses) between addresses 0x51 and 0x5D in the Access Bank while a CAN message reception is in progress. Some of the instruction examples are:
• MOVWF 0x57, A
• ADDWF 0x57, A
• MOVF 0x57, W, A


I found that CCS does what is described above. I fixed all by modifications in CAN driver. CAN driver was accessing CAN buffers independently, I modified it to use WIN, also GPR between 51..5D were located by compiler. I prevented it.

However, I still have a problem like what is described in errata.

Any ideas?
jma_1



Joined: 08 Feb 2005
Posts: 147
Location: Wisconsin

View user's profile Send private message

PostPosted: Tue Oct 02, 2007 11:31 am     Reply with quote

Greetings sapiens,

Assuming your modifications have not introduced a new problem, perhaps there is another source for the issue. Try checking the CAN hardware to see if faults have been detected(TXERR; RXERR). As a work around, try re-initializing the CAN module (bad band-aid).

Do you have the watch dog timer implemented? Perhaps a code problem is causing the processor to get lost in the weeds.

Unfortunately I do not have an 18F458 available to test with.

Cheers,
JMA
sapiens



Joined: 27 Sep 2007
Posts: 4

View user's profile Send private message

PostPosted: Thu Oct 04, 2007 3:06 am     Reply with quote

Hella JMA,

I multiply checked my modifications. I don't think it introduces a problem. The firmware has been checking warnings and errors.

I debugged the firmware. When those things start happenning, the CAN module says that frame received, but if you check the ingredens of frame buffer, it has the last frame content prior to the time the problem started. I figured out that CAN Bus double buffering does not work as it was intended. I say that because if MCU stays in some code a little longer than 2 frame period, RXB0 is filled by the incoming frame, and the second incoming frame is supposed to go into RXB1. If there is a third frame even before the buffers freed, it is supposed to set overlflow flag in RXB1.

However, it does not..
edh329
Guest







Same Issue
PostPosted: Mon Jun 16, 2008 11:00 am     Reply with quote

Has this issue been resolved by anyone. I'm seeing the same issue
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