CAN Bus Receive Interrupt problem

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

CAN Bus Receive Interrupt problem

685 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Richa on Fri Jun 19 23:27:15 MST 2015
Dear LPC community,

I am using LPC1756 microcontroller with the transceiver,SN65HVD233-HT. J1939 transmitter is integrated with LPC1756 via transceiver. The baurd rate is 250kbs.

Iam always getting bus error interrupt while receiving the data from the transmitter.Not able to receive the error free data frame.
The CAN2ICR registor value after enabling all interrupt is 0x790180 and receive error counter value is 81.

Initialization function that used for receiving a CAn data is mentioned below.
void can_Init()
{

    LPC_SC->PCONP       |=  (1 << 14);           /* Enable power to CAN2 block */
    LPC_PINCON->PINSEL4 |=  (0 << 15)|(1 << 14);           /*  RD2 (CAN2) */
    LPC_PINCON->PINSEL4 |=  (1 << 16);           /*  TD2 (CAN2) */
   
   NVIC_EnableIRQ(CAN_IRQn);                    /* Enable CAN interrupt */
   
  LPC_CANAF->AFMR = 2;                           /* By default filter is not used */
  
  LPC_CAN2->MOD   = 1;                               /* Enter reset mode */
  LPC_CAN2->IER   = 0;                               /* Disable all interrupts */
  LPC_CAN2->GSR   = 0;                               /* Clear status register */
       
    /* Set bit timing */

    CAN_cfgBaudrate(250000); 
    LPC_CAN2->IER   = 0x3FF;

   LPC_CAN2->MOD   = 0;        /* Enter normal operating mode */
  
}
static void CAN_cfgBaudrate (uint32_t baudrate) 
{
 
  uint32_t result = 0;
  uint32_t nominal_time;

  /* Determine which nominal time to use for PCLK */
  #define  PCLK            (100000000UL/4)
  if (((PCLK / 1000000) % 6) == 0) {
    nominal_time = 12;                   /* PCLK based on  72MHz CCLK */
  } else {
    nominal_time = 10;                   /* PCLK based on 100MHz CCLK */
  }

  /* Prepare value appropriate for bit time register */
  result  = (PCLK / nominal_time) / baudrate - 1;
  result &= 0x000003FF;
  result |= CAN_BIT_TIME[nominal_time];   //Bit Time code i have taken from c:/keil/arm/boards/keil/mcb1700/can

  LPC_CAN2->BTR  = result;                           /* Set bit timing */

}

Is anyone know How to clear the Buserror for receiving the all the IDs from the simulator.Please help me to solve this issue.
Thanks in Advance.
Labels (1)
0 Kudos
1 Reply

456 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Richa on Thu Jun 25 00:28:42 MST 2015
Hi friends,

Is there any one know about the 29bit identifier acceptance filter in LPC1756. Will it support??

And also need information about the ISO standard for  SAE- J1939-71 protocol. my Transceiver (Sn65hvd233)) is compitable with ISO 11898 standard.So need to know whether the transceiver supports J1939-71 protocol.

Waiting for your replies for both queries.

Thanks in advance.
0 Kudos