Hi Kallappa,
There are two FlexCAN examples in S32 SDK that you can refer: can_pal_s32k148 and flexcan_encrypted_s32k148
For example: Please read the documentation of can_pal_s32k148 first.
The example documentation can be found in the S32 SDK documentation at Examples and Demos section. (<SDK_PATH>/doc/Start_Here.html)
Then configure the PCAN-Pro according to the FlexCAN configuration:
CAN FD
Arbitration Phase 500Kbps
Data Phase 1000Kbps
After press SW3 and SW4, the PCAN-Pro will show the CAN message sent from S32K148EVB board 1.
Best Regards,
Robin
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
Hello Robin,
Thanks for the Quick Support.
As you suggested I went through the example of the FlexCAN encrypted and I am able to run the code successfully,
But for my use case, I slightly modified the main.c file, because I want to send on start one can message to other board.PFA attached main.c file.
But I am not able to get the data on CAN-BUS even I tried to send the data.
Can you please guide me in this what I missed here?
Thanks,
Hello Robin,
Thanks a lot for your great support.
now I am able to send the data on can BUS, it is creating interest now in learning the CAN in guidance of you.
Robin, now I want to receive the data as well for that I wrote the code as below attached the DOC.
but not able to receive the data, I was checking the receive buffer but the data is not updated in that buffer.
Kindly help me with this.
Once again thanks,
Kallappa
When I send CAN data from PCAN, the S32K148EVB is able to toggle LED.(Did you send the data with ID: 74Eh ?)
Hello Robin,
my setup is like NXP board is connected with r-pi with CAN Bus and for sending the data i am using the r-pi terminal with the following command.
cansend can0 74E#11111111
NXP Board Side :
My Config is as mentioned below for the Rx and Tx
#if defined(MASTER)
#define TX_MAILBOX (1UL)
#define TX_MSG_ID 0x74F
#define RX_MAILBOX (2UL)
#define RX_MSG_ID 0x74E
===============================================================
flexcan_data_info_t dataInfo =
{
.data_length = 8,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = true,
.fd_enable = true,
.fd_padding = 0U
};
/* Configure RX message buffer with index RX_MSG_ID and RX_MAILBOX */
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, RX_MAILBOX, &dataInfo, RX_MSG_ID);
======================================================================
flexcan_msgbuff_t recvBuff;
/* Start receiving data in RX_MAILBOX. */
FLEXCAN_DRV_Receive(INST_CANCOM1, RX_MAILBOX, &recvBuff);
/* Wait until the previous FlexCAN receive is completed */
while(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, RX_MAILBOX) == STATUS_BUSY);
Sorry for the delay!
Would you please check if r-pi terminal is corrected configured? I modified the flexcan_encrypted_s32k144 as you shown me in main.
The LEDs is able to toggle.(Check the received message ID toggle LED after FLEXCAN_DRV_Receive )