6 Replies Latest reply on Nov 13, 2013 12:23 AM by resh

    CAN interface on CY8C3866AXI-040ES2

    jitendra.kumar

      Hi,

         

      I want to use CAN Controller on PSOC3 (CY8C3866AXI-040ES2). For that I have congured the CAN BUS to operate at 500Kbps, with system clcok is 24MHz and Baud Rate Prescalar set to 5 i.e. (8TQ = 5TQ (for TSEG1) + 2 TQ (TSEG2) + 1TQ(For SYN), SJW is set to 1. I have configured CAN interface for BASIC CAN ID, with all TX Mail Box configured for Basic Can IDs. CAN TX Line is mapped to P3[4], RX Line mapped to P3[5] and CAN_TX_EN mapped to P3[2].

         

      Using the http://www.cypress.com/?docID=29942 as reference.

         

      The code main loop is

         

      ================================================================================
          LCD_Start();
         
          can_set_acr_amr();
          CAN_GlobalIntEnable();
         
          CAN_Init ();
          CAN_Start ();
         
          CYGlobalIntEnable;  /* Uncomment this line to enable global interrupts. */
         
          LCD_Position(0,0);
          LCD_PrintString("CAN:INIT");

         

      ==================================================================================

         

      And, the transmitting the Message using

         

      ===================================================================================

         

      uint32 bmc_tx_handler (uint8 cmd)
      {
          CAN_TX_MSG can_tx_msg;
          CAN_DATA_BYTES_MSG txmsg;
          int i;  int bcmid = cmd - 1;
         
          can_tx_msg.rtr = EMC_BCM_DISABLE_RTR;
          can_tx_msg.ide = EMC_BCM_STD_CAN_ID;
          can_tx_msg.irq = EMC_BCM_IRQ_ENABLE;
         
          /* initialize CAN MSG packet */
          for (i = 0; i < 8; i++)
                  txmsg.byte[i] = 0x00;
          can_tx_msg.id = EMC_BCM_REQUEST_ID | (bcmid & EMC_BCM_ID_MASK) ;
          can_tx_msg.dlc = EMC_BCM_REQUEST_LEN;
             
          txmsg.byte[0] = emc_bcm_request[cmd].bcm_req;  /* Data to Send */
         
             
          can_tx_msg.msg = &txmsg;
             
          if (CYRET_SUCCESS != CAN_SendMsg (&can_tx_msg))
              return CAN_FAIL;
         
          LCD_WriteControl(LCD_CLEAR_DISPLAY);
          LCD_Position(0,0);
          LCD_PrintString("CAN:TX");
          return CYRET_SUCCESS;

         

      }

         

      =========================================================================

         

      I do not see any error message from SendMsg () after transmition is done. But, I do not see any data on TX line (on probing, it is pulled high level).

         

      Please, let me know if any setting I am missing for CAN.

         

      Thanks

         

      Jitendra