2 Replies Latest reply on Aug 7, 2016 7:40 PM by user_15090130

    CAN protocol

    user_15090130
              Dear all Could some one that have a good and working application for the CY8C5868 or PSOC5PL about CAN application just to send recive message give me one copy? I am trying strong but no way. The micro start to sen message and never stop and never up grade the data. I have also open a case but nothing. .. Best regards and many thanks in advance Attilio Ciaccio Il Gruppo   
        • 1. Re: CAN protocol
          hima

          Hello

             

          Can you please have a look at the application note:http://www.cypress.com/documentation/application-notes/an52701-psoc-3-and-psoc-5lp-getting-started-controller-area-network.

             

          Thanks,

             

          Hima

          • 2. Re: CAN protocol
            user_15090130

            Hi   Hima

               

            Thanks for the suggest but i have seen already this AN, but anyway looking deeper on the code, i note i difference betwen the AN52701 and the code generate for the KIT CY8CKIT-059.

               

            The AN52701, have file CAN_Data_TX_RX_func.c , where we can found the function called by the main.c :   CAN_SendMsgTxMessage1(void)

               

            following the code:

               

            uint8 CAN_SendMsgTxMessage1(void)
                {
                    uint8 result = CYRET_SUCCESS;
                   
                    if ((CAN_TX[0u].txcmd.byte[0u] & CAN_TX_REQUEST_PENDING) ==
                        CAN_TX_REQUEST_PENDING)
                    {
                        result = CAN_FAIL;
                    }
                    else
                    {
                        /* `#START MESSAGE_TxMessage1_TRASMITTED` */

               

                        /* `#END` */
                       
                        CY_SET_REG32((reg32 *) &CAN_TX[0u].txcmd, CAN_SEND_MESSAGE);
                    }
               
                    return(result);
                }

               

            As you can see the condiction,      if ((CAN_TX[0u].txcmd.byte[0u] & CAN_TX_REQUEST_PENDING) ==
                        CAN_TX_REQUEST_PENDING)
            have a compare with  "CAN_TX_REQUEST_PENDING"  define as 01u, but to the kit code we have:

               

            #if (CY_PSOC3 || CY_PSOC5)

               

            if ((CAN_Data_TX[0u].txcmd.byte[0u] & CAN_Data_TX_REQUEST_PENDING) != 0u).

               

            This means that we have always the  CAN_FAIL due to 0u and not 01u.

               

            Actually i am doing a service to the Bolivia  forest , and no way to do any test until next week

               

            Please anyway could you give to  me your opinion?

               

            Best regards

               

            Attilio