can

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

can

397 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hunybal on Mon Dec 24 00:26:53 MST 2012
hello
i want to use can_onchip example in keil with lpc11c14.and i have two questions:

1-how i can config the btr (bs1,bs2,sjw)? the other device is in baud rate is 450[B] kbit/s[/B]?


2- how i can config the ram in keil that start form  0x100000B8  ?
thanks
0 Kudos
5 Replies

352 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Dec 31 08:03:38 MST 2012
#1 Use your debugger to check if your CAN_rx is receiving anything (and don't use a UART call in there) :eek:

#2 Scope your hardware, especially exact bitrates. What bitrate are you receiving and what setup are you using to receive / transmit :confused:
0 Kudos

352 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hunybal on Mon Dec 31 07:24:05 MST 2012
thank you zero.
i config the baudrate and send data successfully.
but i cant receive data from msg_obj
void CAN_rx(uint8_t msg_obj_num){
  
  /* Determine which CAN message has been received */
  msg_obj.msgobj = msg_obj_num;

  /* Now load up the msg_obj structure with the CAN message */

  ([COLOR=Red]*rom)->pCAND->can_receive(&msg_obj);
  UARTSend(msg_obj.data,8 );
[/COLOR]
  if (msg_obj_num == 1)
  {
    /* Simply transmit CAN frame (echo) with with ID +0x100 via buffer 2 */
    msg_obj.msgobj = 2;
    msg_obj.mode_id += 0x100;
    (*rom)->pCAND->can_transmit(&msg_obj);
  }

  return;
}


........................


    msg_obj.msgobj = 5;
    msg_obj.mode_id = 0x0;
    msg_obj.mask = 0x0;
    (*rom)->pCAND->config_rxmsgobj(&msg_obj);



i want to send received data troth the usart but nothing send, please help me
0 Kudos

352 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Dec 26 05:54:55 MST 2012

Quote: hunybal
do you have any example with can-onchip in keil?



No (this is a [COLOR=Red]LPCXpresso forum[/COLOR], so I don't use Keil ;))

How to calculate BTR is described in the link above. Since BTR is divided from your main clock it could be useful to choose a main clock like 45MHz :eek:

Then just set BRP/TSEG1 and TSEG2 to divide this by 100 and you get 450kHz :D
0 Kudos

352 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by hunybal on Wed Dec 26 01:19:24 MST 2012
thank you zero

i read #5 and many other threads but somethings have different!!:confused:

//can speed
#define BPS83          0x00006F57UL  // CAN_BTR   83kHz
#define BPS100      0x00002F57UL  // CAN_BTR  100kHz
#define BPS125      0x00001C57UL  // CAN_BTR  125kHz
#define BPS250      0x00001457UL  // CAN_BTR  250kHz
#define BPS500      0x00000157UL  // CAN_BTR  500kHz
#define BPS1000      0x0000014BUL  // CAN_BTR 1000kHz



and


// Initialize CAN Controller  @12MHz
uint32_t ClkInitTable[2] =
{
  0x00000000UL, // CANCLKDIV: /1 = 12MHz
  0x1201UL      // CAN_BTR: 1000khz 
};




do you have any example with can-onchip in keil?

thanks for your replay
0 Kudos

352 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Mon Dec 24 01:53:16 MST 2012

Quote: hunybal
1-how i can config the btr (bs1,bs2,sjw)? the other device is in baud rate is 450[B] kbit/s[/B]?


CAN BTR register settings are described in #5 of http://knowledgebase.nxp.com/showthread.php?t=2829


Quote: hunybal
2- how i can config the ram in keil that start form  0x100000B8  ?


Keil Forum is here: http://www.keil.com/forum/
0 Kudos