S32K148EVB - Establish CAN communication to Vector CAN

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

S32K148EVB - Establish CAN communication to Vector CAN

ソリューションへジャンプ
3,816件の閲覧回数
Chandra13
Contributor I

Hello,

I am using the following,

  1. Hardware: S32K148EVB - Q176
  2. Debugger: PE Micro (Flashing/Debugging using the 20-pin mini JTAG)
  3. IDE: Design Studio 3.4 and S32_SDK_S32K1xx_RTM_4.0.3
  4. CAN Device: VN1630 Hardware with Canoe 16
  5. Connections (EVB to CAN-VN1630 CHN 1)
    • J11.1 to DB9.7 for CAN_H
    • J11.2 to DB9.2 for CAN_L

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.

0 件の賞賛
返信
1 解決策
3,778件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Chandra13

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.

 

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
3,798件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Chandra13

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)

 

Senlent_1-1671503052685.png

#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;
}



 

0 件の賞賛
返信
3,789件の閲覧回数
Chandra13
Contributor I

Thank you for your response @Senlent !

  1. Yes, I am using a 12v power supply for the EVB
  2. I am using the CAN FD 500kBaud/4MBaud configuration from the Canoe
  3. I copy pasted your code in the main under the flexcan_encrypted_s32k148. The build is fine.
    • However, when I debug, it triggers the devassert.h at the below line in the main function.
    • CLOCK_SYS_UpdateConfiguration(0U, CLOCK_MANAGER_POLICY_AGREEMENT)

Finally, the picture you described for the FlexCAN configuration. Is this accessible in the design studio?

0 件の賞賛
返信
3,779件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Chandra13

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.

 

0 件の賞賛
返信
3,766件の閲覧回数
Chandra13
Contributor I

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?

0 件の賞賛
返信
3,762件の閲覧回数
Senlent
NXP TechSupport
NXP TechSupport

Hi@Chandra13

you can take a look at our S32K Knowledge Base  , there're many demos for your reference.

1S32K Examples 

2.S32K1xx-FlexCAN Mask Setting Demo 

you can refer to these demos to meet your needs.

 

0 件の賞賛
返信