CAN BUS DATA RECEPTION PROBLEM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CAN BUS DATA RECEPTION PROBLEM

2,527 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nirav_bhatt07@yahoo.in on Fri Aug 29 03:11:04 MST 2014
hello, we are using lpc4357 for the application of data transfer between two CAN NODES, we have the demo code for the lpc4357 as below:\lpc43xx-2013-09-04\lpc43xx\Examples.
     it is working fine for the transmitting the data bytes to the other node, but while receiving we have a problem that we are not receiving any kind of interrupt as well as data.
      please anybody who have cleared this application please send us the demo working code...
thanks...regards...
   i am attaching the file that i have tested for transmitting..

anybody please send me the runnig sample code for CAN bus application on lpc4357 board??
标签 (1)
0 项奖励
回复
11 回复数

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by St.Nicholas on Thu Feb 26 01:53:36 MST 2015
For sample code, write to Nicholas_Papachristos@Contractor.Net for a fast response.
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by cacycleworks on Wed Feb 25 15:34:24 MST 2015

Quote: St.Nicholas
Finally I got the 4357 CAN working both in Basic mode (not recommended), and in the unfiltered mode, i.e. the acceptance filter lets all the messages through. One major problem is that the 4357 user manual does not contain all the information, and some of it not clear.

1. Basic Mode: After reading the manual several times, I realised that the TEST bit in the control register had to be permanently set, as well as the BASIC bit in the test register. Also, there is no ware any information where to read the message ID from, and the message length - I had to reverse engineer it by watching all the registers to see what changed.
2. The LPCOPEN API is a bit crude. I had to resort to some bare register access, and rework the message object setup function, after which my application worked.

I must thank the STR9 & KEIL whose example for the same CAN cell actually works, and helped me to complete my mission.

Cheers, Nicholas



Do you have any sample code for how you did get the ID and length? Or notes about how you accessed this? I'm considering using NXP for a CAN application but it seems the code isn't really implemented.

Thanks,
Chris
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by St.Nicholas on Wed Oct 22 04:56:32 MST 2014
It is I and not NXP who does not recommend it. The reason is that in Basic mode, unless you read the data fast enough, they could be over-written - as there is no buffering. E.g. if you disable your interrupts for a short period, etc.
If you have sufficient time gaps between the messages, then there should not be a problem.
Cheers, Nicholas
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sal Ammoniac on Tue Oct 21 21:25:36 MST 2014
Why do you say Basic Mode is not recommended?
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by St.Nicholas on Thu Oct 16 06:25:52 MST 2014
Hi Friends,

Finally I got the 4357 CAN working both in Basic mode (not recommended), and in the unfiltered mode, i.e. the acceptance filter lets all the messages through. One major problem is that the 4357 user manual does not contain all the information, and some of it not clear.

1. Basic Mode: After reading the manual several times, I realised that the TEST bit in the control register had to be permanently set, as well as the BASIC bit in the test register. Also, there is no ware any information where to read the message ID from, and the message length - I had to reverse engineer it by watching all the registers to see what changed.
2. The LPCOPEN API is a bit crude. I had to resort to some bare register access, and rework the message object setup function, after which my application worked.

I must thank the STR9 & KEIL whose example for the same CAN cell actually works, and helped me to complete my mission.

Cheers, Nicholas
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by St.Nicholas on Wed Oct 15 06:30:11 MST 2014
Hi Friends,

I checked the above example, but it applies for a completely different chip with a different CAN implementation. It does not apply to the LPC4357 (original post).

The example for  LPC4357 though works only for specific IDs. Any ideas ?

Cheers, Nicholas
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Sep 24 22:37:54 MST 2014


http://www.lpcware.com/content/nxpfile/lpcopen-software-development-platform-lpc40xx-packages
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nirav_bhatt007 on Wed Sep 24 22:29:04 MST 2014
NO i don't have that LPCOpen code for the CAN BUS...
it would be really helpful to me if u just send that code or send me a download link for the same...
regards..
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by LabRat on Wed Sep 24 21:58:22 MST 2014
Isn't there a LPCOpen sample?
0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nirav_bhatt007 on Wed Sep 24 21:32:05 MST 2014
thanks for reply,
  it is not the problem with overclocking of can peripheral , i have already tested this code for PCLK (peripheral clock) of CAN as 12 MHz.
  here are the initializatin code of C_CAN0 PLEASE SEND me the suggestions if any??

void CAN_Init( uint32_t BitClk, CCAN_CLKDIV_Type ClkDiv , MSG_CB Tx_cb, MSG_CB Rx_cb)
{

//RX_cb = Rx_cb;
//TX_cb = Tx_cb;

if (!(LPC_C_CAN0->CNTL & CTRL_INIT))
{
/* If it's in normal operation already, stop it, reconfigure
everything first, then restart.  */
LPC_C_CAN0->CNTL |= CTRL_INIT;/* Default state */
}

LPC_C_CAN0->CLKDIV = ClkDiv;/* Divider for CAN VPB3 clock */
LPC_C_CAN0->CNTL |= CTRL_CCE;/* Start configuring bit timing */
LPC_C_CAN0->BT = BitClk;
LPC_C_CAN0->BRPE = 0x0000;
LPC_C_CAN0->CNTL &= ~CTRL_CCE;/* Stop configuring bit timing */
LPC_C_CAN0->CNTL |= CTRL_IE;/* CAN interrupt enable */

Config_Rx_Mes_Obj();

LPC_C_CAN0->CNTL &= ~CTRL_INIT;/* Initialization finished, normal operation now. */
while ( LPC_C_CAN0->CNTL & CTRL_INIT );

// By default, auto TX is enabled, enable all related interrupts
LPC_C_CAN0->CNTL |= (CTRL_IE|CTRL_SIE|CTRL_EIE);

return;
}

here BitClk value is 0x00004501 for 500khz baudrate and 12 mhz as PCLK _C_CAN0...
and ClkDiv value is 0 maens devided by 1...


this works fine for transmitting the data bytes to other peripheral but i came across the problem while receiving the data.

SEND ME THE NEXT suggestion ....

Regards,..

0 项奖励
回复

2,462 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by otscherw on Thu Sep 18 10:16:25 MST 2014
Hi,
maybe it's the same problem that I had. (http://www.lpcware.com/content/forum/can-errata-lpc4337).
It turned out that I was overclocking the CAN unit and that resulted in malfunction (no or no correct reception of CAN messages).

Regards,
Oliver
0 项奖励
回复