LPC11C14 - problem during CAN communication

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11C14 - problem during CAN communication

989 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Fri Oct 24 02:56:02 MST 2014
Dear All,

I've noticed a problem using the LPC11C14 for CAN communication.
Micro is connected to an external TJA1040 driver. If I turn off the suplly voltage for a small period the micro doesn't reset (the 3,3V doesn't drop) but the Driver supply (5V) drops immediately, creating problem with CAN communication. In this case the micro doesn't communicate anymore with CAN ports. Everithing is working well with the micro (UART communication, SPI communication ect.) but the CAN ports don't communicate.
Is there a way to make the micro detecting this ports' block and reset this?

Thank you in advance,

Mattia 
Labels (1)
0 Kudos
12 Replies

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Mon Oct 27 04:19:28 MST 2014
Thank you ;), I did it.
It seems strange to me that it works because, according to datasheet


Quote:

Remark: The busoff recovery sequence (see CAN Specification Rev. 2.0) cannot be shortened by setting or resetting the INIT bit. If the device goes into busoff state, it will set INIT, stopping all bus activities. Once INIT has been cleared by the CPU, the device will then wait for 129 occurrences of Bus Idle (129 x 11 consecutive HIGH/recessive bits) before resuming normal operations. At the end of the busoff recovery sequence, the Error Management Counters will be reset.




but it works!
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Mon Oct 27 02:30:05 MST 2014

Quote: mattiad
...which is the correct command (in terms of code) to Initialize?



How do you init your CAN (in terms of code)?

Usually it's enough to repeat that after BUS off...

0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Mon Oct 27 02:24:11 MST 2014
Dear LabRat,

I've understood your  example after having studied a little bit of CAN bus specification.
Now I have another question: if I want to reset my CAN controller I need to check if the bit BUS_OFF is active. If so, which is the correct command (in terms of code) to Initialize?

Best Regards 
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Sat Oct 25 06:47:23 MST 2014
Dear LabRat,

I'm sorry but my low experience with fieldbus and micro makes me unable to understand well your example.
In your enviroment you check if the Bus off flac is active. Why should it be active? Why a CAN-display or a sniffer could disturb can? Maybe you mean that the noisy enviroment disturbs the can communication?
Furthermore, when i remove my can controller from my LPC-CAN board it doesn't make active the BusOff flag: I just see active the  CAN_ERROR_ACK flag.

Sorry for my misunderstandings  :)
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sat Oct 25 04:47:30 MST 2014

Quote: mattiad
Could you give me an example?



Example:

Sometimes I'm using CAN in rough environment (old cars). Then it's the only CAN device, but I also want to use a CAN-Display or Sniffer sometimes. So I'm using Bus Off together with a timer and counter to see if there's another CAN device or something else is disturbing CAN. If MCU is detecting Bus Off it's trying to init CAN again, 10 times with 100ms delay...
After that it decides that there's no other CAN device and doesn't try to use CAN any more  :)
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Sat Oct 25 04:08:57 MST 2014
Thank you very much.
Just another question about the BUS OFF condition. Is there a possibility that CAN_ERROR_BOFF is active but there's a temporary problema and not a real problem? Could you give me an example?

Best Regards
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Sat Oct 25 00:27:46 MST 2014

Quote: mattiad
In this case I think that the best thing is to check if the CAN_ERROR_BOFF is active and in this case reset the can.



A good way to handle Bus Off is to init CAN again...

Together with a timer you can also delay this attempts and count them. So it's possible to differentiate between temporary problems and real problems...
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Fri Oct 24 16:19:03 MST 2014
Hi,

Can_error callback gives me a value of 71.
According to manual it would mean that the following flags are active

CAN_ERROR_PASS
CAN_ERROR_WARN
CAN_ERROR_BOFF
CAN_ERROR_BIT1

In this case I think that the best thing is to check if the CAN_ERROR_BOFF is active and in this case reset the can.
Do you agree with me?

Thank you

Mattia
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Fri Oct 24 07:16:47 MST 2014
Yes, I have a 10uF capacitor on 5Vsupply.
I'm not using the STB, it is connected to ground with a 30k resistance.
I still have to check the CAN error callback. At the moment what I notice is just a block of canopen communication.
I'm going to check this.

Mattia
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Oct 24 03:42:51 MST 2014

Quote: mattiad
If possible I would prefer that the micro detects if can communication is blocked.



That's of course no usual effect...

Did you try to add a cap to your 5V supply?

Are you using STB of transceiver?

Last not least: which CAN errors is your CAN error callback showing?
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mattiad on Fri Oct 24 03:21:00 MST 2014
Hi,
thank you for the answer and sorry for the mistake ;). As you will notice English is not my motherthongue.
At the moment have to use this 5V driver and I don't know how to solve the problem in another "hardware way".
If possible I would prefer that the micro detects if can communication is blocked.

Thank you,


Mattia
0 Kudos

843 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Fri Oct 24 03:12:07 MST 2014
Would strongly recommend to use a 3.3V 'suplly' voltage transceiver...
0 Kudos