Hello,
I am using the following,
I am trying to output the CAN messages to the J11 port and read the messages in Canoe using the VN1630. I used the examples can_pal_s32k148 and flexcan_encrypted_s32k148 from the SDK_RTM_4.0.3 to test this feature. But the results are negative as I cannot see any messages in the Canoe Trace window.
Solved! Go to Solution.
1.sorry for the mistake, please delect this sentence and try again.
:CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
2.yes, select your project, right click and select S32 configuration tools -> open peripherals then you can see the configuration window.
1.Please make sure external 12V power supply was used for S32K148EVB,elsewise the CAN PTY will not work.
2. these two demo enabled the CAN FD features, so please make sure the PC software configuration is right.
3. I made a sample demo for your reference, you can try it, this demo should periodically send frames with ID 0x01(500K)
#include "sdk_project_config.h"
#include <stdint.h>
#include <stdbool.h>
volatile int exit_code = 0;
flexcan_msgbuff_t recvMsg;
flexcan_data_info_t dataInfo =
{
.data_length = 8U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = false,
.fd_enable = false,
.fd_padding = 0U
};
int main(void)
{
uint8_t DummyData[8] = {0};
/* Configure clocks for PORT */
CLOCK_DRV_Init(&clockMan1_InitConfig0);
CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
PINS_DRV_Init(NUM_OF_CONFIGURED_PINS0, g_pin_mux_InitConfigArr0);
FLEXCAN_DRV_Init(INST_FLEXCAN_CONFIG_1, &flexcanState0, &flexcanInitConfig0);
/*Configure a Tx Message Buffer.*/
FLEXCAN_DRV_ConfigTxMb(INST_FLEXCAN_CONFIG_1, 0, &dataInfo, 0x01);
FLEXCAN_DRV_SetRxMaskType(INST_FLEXCAN_CONFIG_1,FLEXCAN_RX_MASK_GLOBAL);
FLEXCAN_DRV_SetRxMbGlobalMask(INST_FLEXCAN_CONFIG_1,FLEXCAN_MSG_ID_STD,0xFFFFFFFF);
/* Configure RX message buffer with index RX_MSG_ID and RX_MAILBOX */
FLEXCAN_DRV_ConfigRxMb(INST_FLEXCAN_CONFIG_1, 1, &dataInfo, 0x02);
/*Receives a CAN frame into a configured message buffer.*/
FLEXCAN_DRV_Receive(INST_FLEXCAN_CONFIG_1,1,&recvMsg);
while(1)
{
OSIF_TimeDelay(1000);
DummyData[0] = 0xff;
FLEXCAN_DRV_Send(INST_FLEXCAN_CONFIG_1,0,&dataInfo,0x01,DummyData);
}
for(;;) {
if(exit_code != 0) {
break;
}
}
return exit_code;
}
Thank you for your response @Senlent !
Finally, the picture you described for the FlexCAN configuration. Is this accessible in the design studio?
1.sorry for the mistake, please delect this sentence and try again.
:CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT);
2.yes, select your project, right click and select S32 configuration tools -> open peripherals then you can see the configuration window.
Thank you @Senlent !
I can now successfully transmit a CAN message from the EVB and I can see a response in the Canoe.
If I transmit a CAN message from the Canoe back to the EVB, how can I process the information in the EVB?
you can take a look at our S32K Knowledge Base , there're many demos for your reference.
2.S32K1xx-FlexCAN Mask Setting Demo
you can refer to these demos to meet your needs.