Example MPC5748G FlexCAN FD simple TX/RX GHS614

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Example MPC5748G FlexCAN FD simple TX/RX GHS614

Example MPC5748G FlexCAN FD simple TX/RX GHS614

********************************************************************************
* Detailed Description:
*
* Configures the FlexCANs to transmit and receive a CAN FD message with or without
* bit rate switching for data phase.
* Baudrate during arbitration phase is set to 500kbps, during data phase 2Mpbs.
*
* In this config, CAN_0 transmits a message. CAN_1 receives the message.
*
* EVB connection:
*
* CAN0-CANH on P15-1 to CAN1-CANH on P14-1
* CAN0-CANL on P15-2 to CAN1-CANL on P14-2
*
* NOTE! Termination resistor (120Ohm) have to be placed on transceivers output
*
* ------------------------------------------------------------------------------
* Test HW:  X-MPC574xG-324DS + X-MPC574XG-MB
* Maskset:  1N81M
* Target :  FLASH
* Fsys:     160 MHz PLL
*
********************************************************************************

Labels (1)
Attachments
Comments

HI!

Which CAN FD analyzer do you use?

Hi,

I did not use CAN analyzer, only scope and debugger.

Petr

Hi.

I want use MB[1] receive CAN FD.

I only modify "void FlexCAN1_Init(void)" this section:

CAN_1.MB[1].CS.B.IDE = 0; 
CAN_1.MB[1].ID.B.ID_STD = 0; 
CAN_1.MB[1].CS.B.CODE = 4; 

And modify "void ReceiveMsgFD(void)" this Section:

while (CAN_1.IFLAG1.B.BUF4TO1I != 1) {};  /* Wait for CAN 1 MB 1 flag */

but always stopped at  "while (CAN_1.IFLAG1.B.BUF4TO1I != 1) {};  "

Where i lost initialization CAN1 of MB[1] setting?

How can i do?

Jim Huang

Hi,

did you really sent message with std ID = 0, so it can be received into MB1? Mask register RXIMR[1] was set 0x1FFFFFFF so the received ID must equal. 

Also check the IFLAG1 register directly in the debugger if flag is set or not.

BR, Petr

Hi, 

I imported this project into my S32 Design Studio. Import method is File -> Import -> Project from Folder or Archive. But I can not build or debug this project anymore. Do you know why? I just started using this IDE, thank you!

Tianxiang

%3CLINGO-SUB%20id%3D%22lingo-sub-1127742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EExample%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E********************************************************************************%3CBR%20%2F%3E*%20Detailed%20Description%3A%3CBR%20%2F%3E*%3CBR%20%2F%3E*%20Configures%20the%20FlexCANs%20to%20transmit%20and%20receive%20a%20CAN%20FD%20message%20with%20or%20without%3CBR%20%2F%3E*%20bit%20rate%20switching%20for%20data%20phase.%20%3CBR%20%2F%3E*%20Baudrate%20during%20arbitration%20phase%20is%20set%20to%20500kbps%2C%20during%20data%20phase%202Mpbs.%3CBR%20%2F%3E*%20%3CBR%20%2F%3E*%20In%20this%20config%2C%20CAN_0%20transmits%20a%20message.%20CAN_1%20receives%20the%20message.%3CBR%20%2F%3E*%3CBR%20%2F%3E*%20EVB%20connection%3A%3CBR%20%2F%3E*%20%3CBR%20%2F%3E*%20CAN0-CANH%20on%20P15-1%20to%20CAN1-CANH%20on%20P14-1%3CBR%20%2F%3E*%20CAN0-CANL%20on%20P15-2%20to%20CAN1-CANL%20on%20P14-2%3CBR%20%2F%3E*%3CBR%20%2F%3E*%20NOTE!%20Termination%20resistor%20(120Ohm)%20have%20to%20be%20placed%20on%20transceivers%20output%3CBR%20%2F%3E*%3CBR%20%2F%3E*%20------------------------------------------------------------------------------%3CBR%20%2F%3E*%20Test%20HW%3A%26nbsp%3B%20X-MPC574xG-324DS%20%2B%20X-MPC574XG-MB%3CBR%20%2F%3E*%20Maskset%3A%26nbsp%3B%201N81M%3CBR%20%2F%3E*%20Target%20%3A%26nbsp%3B%20FLASH%3CBR%20%2F%3E*%20Fsys%3A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20160%20MHz%20PLL%3CBR%20%2F%3E*%3CBR%20%2F%3E********************************************************************************%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1127742%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EGeneral%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127747%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20imported%20this%20project%20into%20my%20S32%20Design%20Studio.%20Import%20method%20is%20File%20-%26gt%3B%20Import%20-%26gt%3B%20Project%20from%20Folder%20or%20Archive.%20But%20I%20can%20not%20build%20or%20debug%20this%20project%20anymore.%20Do%20you%20know%20why%3F%20I%20just%20started%20using%20this%20IDE%2C%20thank%20you!%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ETianxiang%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127746%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127746%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3Edid%20you%20really%20sent%20message%20with%20std%20ID%20%3D%200%2C%20so%20it%20can%20be%20received%20into%20MB1%3F%20Mask%20register%20RXIMR%5B1%5D%20was%20set%200x1FFFFFFF%20so%20the%20received%20ID%20must%20equal.%26nbsp%3B%3C%2FP%3E%3CP%3EAlso%20check%20the%20IFLAG1%20register%20directly%20in%20the%20debugger%20if%20flag%20is%20set%20or%20not.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127745%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127745%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi.%3C%2FP%3E%3CP%3EI%20want%20use%20MB%5B1%5D%20receive%20CAN%20FD.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20only%20modify%20%22void%20FlexCAN1_Init(void)%22%20this%20section%3A%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3ECAN_1.MB%5B1%5D.CS.B.IDE%20%3D%200%3B%26nbsp%3B%3CBR%20%2F%3E%20CAN_1.MB%5B1%5D.ID.B.ID_STD%20%3D%200%3B%26nbsp%3B%3CBR%20%2F%3E%20CAN_1.MB%5B1%5D.CS.B.CODE%20%3D%204%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EAnd%26nbsp%3B%3CSPAN%3Emodify%20%22void%20ReceiveMsgFD(void)%22%20this%26nbsp%3BSection%3A%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ewhile%20(CAN_1.IFLAG1.B.BUF4TO1I%20!%3D%201)%20%7B%7D%3B%20%26nbsp%3B%2F*%20Wait%20for%20CAN%201%20MB%201%20flag%20*%2F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3Ebut%26nbsp%3B%3CSPAN%3Ealways%20stopped%20at%20%26nbsp%3B%22while%20(CAN_1.IFLAG1.B.BUF4TO1I%20!%3D%201)%20%7B%7D%3B%20%26nbsp%3B%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%3EWhere%20i%20lost%20initialization%20CAN1%20of%20MB%5B1%5D%20setting%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%3EHow%20can%20i%20do%3F%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%3EJim%20Huang%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127744%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127744%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20did%20not%20use%20CAN%20analyzer%2C%20only%20scope%20and%20debugger.%3C%2FP%3E%3CP%3EPetr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1127743%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Example%20MPC5748G%20FlexCAN%20FD%20simple%20TX%2FRX%20GHS614%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1127743%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3EHI!%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22color%3A%20%2351626f%3B%20background-color%3A%20%23ffffff%3B%22%3EWhich%20CAN%20FD%20analyzer%20do%20you%20use%3F%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎12-15-2016 06:06 AM
Updated by: