CAN interface on CY8C3866AXI-040ES2

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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 = 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

0 Likes
6 Replies
Anonymous
Not applicable

 Hi,

   

I think the code is perfectly fine. If you are using CY8CKIT-017 as external transceiver, the pin connections are not as mentioned. It should be P3[2] for Tx_Enable, P3[3] for TX and P3[4] for RX.

   

Try the edited project file included below.

   

0 Likes
Anonymous
Not applicable

 Hi,

   

I think the code is perfectly fine. If you are using CY8CKIT-017 as external transceiver, the pin connections are different. It should be P3[2] for Tx_Enable, P3[3] for TX and P3[4] for RX.

   

Try the edited project file included below.

   

0 Likes
Anonymous
Not applicable
0 Likes
Anonymous
Not applicable

Sorry. Attaching project withh this post.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

There seems to be an error with uploading the zipped project. Posting it on behalf of  ranju. This project was tested on Production version of PSoC 3.

0 Likes
Anonymous
Not applicable

 In CAN protocol, after transmitting each bit into the bus, every node checks if the bus state is same as the bit it transmitted. If they are the same, node continues with the transmission of next bit and if they are different, the node stops transmitting and starts to receive the message on the bus. So, if you do not connect the transceiver IC, the node will not see the same bit which it has transmitted on the Rx pin since there is no loop back. So it will stop transmitting. So you won't see any traffic on the Tx pin if you haven't connected a transceiver IC or  CY8CKIT-017 to the PSoC 

0 Likes