Main Site Documentation

CAN issue


#1

I have some problems with CAN on USBizi100
From time to time, board stops to receive messages till I reinitialize CAN object, or to send directly a soft reset to controller through CAN1CMR register.
I know there is traffic on the CAN network, because I have another board (EM) connected.
The problem occurs only If i have acceptance filter enabled.
With filter disable,the board receives millions messages with no gaps between.
I’m almost sure acceptance filter is correctly set, because I have a lot of EM modules running in the same manners for more than one year

I found an errata sheet for LPC23xx describing one CAN problem .
The document could be found here: http://ics.nxp.com/support/documents/microcontrollers/pdf/errata.lpc2387.pdf

"3.16 CAN.1: Data Overrun condition can lock the CAN controller
Introduction:
Each CAN controller provides a double Receive Buffer (RBX) per CAN channel to store
incoming messages until they are processed by the CPU. Software task should read and
save received data as soon as a message reception is signaled.
In cases where both receive buffers are filled and the contents are not read before the
third message comes in, a CAN Data Overrun situation is signaled. This condition is
signaled via the Status register and the Data Overrun Interrupt (if enabled).
Problem:
In a Data Overrun condition, the CAN controller is locked from further message reception.
Work-around:

  1. Recovering from this situation is only possible with a soft reset to the CAN controller.
  2. If software cannot read all messages in time before a third message comes in, it is
    recommend to change the acceptance filtering by adding further acceptance filter
    group(s) for messages, which are normally rejected. With this approach, the third
    incoming message is accepted and the Data Overrun condition is avoided. These
    additional messages are received with the corresponding group index number can be
    easily identified and rejected by software.
    "
    Could be USBizi affected by this bug, or could be something else?

#2

Are you using register access to control CAN controller filters?

Did you check that you are not “bus off”? Check error counters


#3

Yes,I’m using register to control filters.
Registries doesn’t seems to reports errors.
Here is a typical status(I’m using CAN1):
CAN1SR: 789516
CAN1MOD: 0
CAN1GSR: 12
CAN1ICR: 0
CANMSR: 0


#4

Now,I’m able to reproduce the error in a simple application.
If is there only one thread reading filtered messages,the program run with no problem .
But if I start another thread searching for an one-wire device,after a short time CAN controller stops to receive messages.


#5

How fast are you sending messages and how many? Because it says it will lock up when it receives three messages very fast…

In onewire, is the problem searching or communicating? Try communications alone, do you have problems?


#6

I post messages as fast I can with an EM board(1000-1500 msg/min)
I have no problem with one-wire.
One-wire thread is searching only for devices,I’m just interesting to find SN of i-buttons connected , but I have observed CAN run normally when I stop
one-wire thread.
I’m not sure I’m in the bug described by the document,because I have no data
overrun reported by the processor register.


#7

So on your application, you will probably never see the problems as your message will come few times/sec but you are doing stress tests and this is how you discovered the preprocessor’s errata issue?


#8

I am asking about one wire communications because right now we block for every byte not bit. But you can try this in managed code:

void MyOneWireWriteByte(byte data)
{
     byte mask;
     for (mask = 0x01; mask; mask <<= 1)
     if (data & mask)
	WriteBit(1);
     else
	WriteBit(0);
}