S32K148 FLEXCAN Not transmitting on USB FD tool

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

S32K148 FLEXCAN Not transmitting on USB FD tool

Jump to solution
1,976 Views
kavyakoney
Contributor II

I  am working on CAN transmission using S32K148 (176 LQFP package) and  USB CAN FD adapter.

In S32 Design Studio, I’ve configured the CAN controller for 500 kbps with the following settings:

Prescaler: 6

Propagation Segment: 7

Phase Segment 1: 4

Phase Segment 2: 4

Resync Jump Width: 1

CAN Clock: 48 MHz

This gives a total of 16 TQ, which results in a 2.0 µs bit time (500 kbps).

The CAN bus is synchronizing and everything is working on code, i am able to see transmission success through debugging but its not transmitting in USB CAN FD tool.

Did i miss any configuration? Can anyone help me with this? I'm unable to figure it out!

 

Tags (1)
0 Kudos
Reply
1 Solution
1,914 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you have loopback mode enabled still, that's why you see message transmitted in debug mode.

PetrS_0-1763106759493.png

Uncheck this option and add Port_Init (NULL_PTR); into your code to Initialize all pins using the Port driver.

BR, Petr

View solution in original post

4 Replies
1,954 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

CAN bit timing looks correct. You can try to increase RJW to its max (4).
CAN clock 48MHz can indicate FIRC is used, if yes select rather FXOSC or PLL running from FXOSC, due to its accuracy.
I am not clear of sentence "The CAN bus is synchronizing and everything is working on code, i am able to see transmission success through debugging but its not transmitting in USB CAN FD tool."
Does it mean CAN tool does not receive any message and/or is not able to transmit any?How do you check transmission success in debug?
Do you see message transmitted on bus, using scope/analyzer? Do you see error detected (you can check ECR, ESR1 registers)? 

BR, Petr

0 Kudos
Reply
1,939 Views
kavyakoney
Contributor II

Hi Petr,

Thanks for the feedback. I checked the registers during runtime, and here’s what I’m seeing:

ESR1: Bus is idle, synchronization bit is set (module is synchronized).

MCR:

LPMACK = 0 - Not in low-power mode

FRZACK = 0 - Not in freeze mode

NOTRDY = 0 -FlexCAN is in normal/listen-only mode

HALT = 0 - No freeze request

MDIS = 0- Module is enabled

IFLAG1: After transmitting, BUF01 becomes 1

BUF4TO1: Bit 1 is set, confirming TX buffer interrupt flag

So it looks like the controller is initialized correctly and transmission is happening from the MCU side.

I also verified that the CAN bit timing matches 500 kbps. I’ll try increasing RJW to the maximum value (4) as you suggested.

the MCU-side transmission call can_43_FlexCAN_write returns E_OK and I can see the TX buffer flag set in debugging, but no frames appear in the USB-CAN FD adapter tool.

I’ll check on the analyzer next to confirm whether any signal is actually going out on the CAN_TX pin.

Also I'm using TJA1042 transciever so I made STB pin low for making it normal mode.

Do i need to do anything extra for transmitting?

if anything i left , let me know.

I have attached my project below.

Thank you.

 

Tags (3)
0 Kudos
Reply
1,915 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you have loopback mode enabled still, that's why you see message transmitted in debug mode.

PetrS_0-1763106759493.png

Uncheck this option and add Port_Init (NULL_PTR); into your code to Initialize all pins using the Port driver.

BR, Petr

1,858 Views
kavyakoney
Contributor II

Yeah . Thank you so much !!

I forgot to initialize port and now It worked.

Tags (1)
0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2204500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ES32K148%20FLEXCAN%20Not%20transmitting%20on%20USB%20FD%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204500%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%26nbsp%3B%20am%20working%20on%20CAN%20transmission%20using%20S32K148%20(176%20LQFP%20package)%20and%26nbsp%3B%20USB%20CAN%20FD%20adapter.%3C%2FP%3E%3CP%3EIn%20%3CSTRONG%3ES32%20Design%20Studio%3C%2FSTRONG%3E%2C%20I%E2%80%99ve%20configured%20the%20CAN%20controller%20for%20%3CSTRONG%3E500%20kbps%3C%2FSTRONG%3E%20with%20the%20following%20settings%3A%3C%2FP%3E%3CP%3EPrescaler%3A%206%3C%2FP%3E%3CP%3EPropagation%20Segment%3A%207%3C%2FP%3E%3CP%3EPhase%20Segment%201%3A%204%3C%2FP%3E%3CP%3EPhase%20Segment%202%3A%204%3C%2FP%3E%3CP%3EResync%20Jump%20Width%3A%201%3C%2FP%3E%3CP%3ECAN%20Clock%3A%2048%20MHz%3C%2FP%3E%3CP%3EThis%20gives%20a%20total%20of%2016%20TQ%2C%20which%20results%20in%20a%202.0%20%C2%B5s%20bit%20time%20(500%20kbps).%3C%2FP%3E%3CP%3EThe%20CAN%20bus%20is%20synchronizing%20and%20everything%20is%20working%20on%20code%2C%20i%20am%20able%20to%20see%20transmission%20success%20through%20debugging%20but%20its%20not%20transmitting%20in%20USB%20CAN%20FD%20tool.%3C%2FP%3E%3CP%3EDid%20i%20miss%20any%20configuration%3F%20Can%20anyone%20help%20me%20with%20this%3F%20I'm%20unable%20to%20figure%20it%20out!%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2205563%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K148%20FLEXCAN%20Not%20transmitting%20on%20USB%20FD%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2205563%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EYeah%20.%20Thank%20you%20so%20much%20!!%3C%2FP%3E%3CP%3EI%20forgot%20to%20initialize%20port%20and%20now%20%3CSTRONG%3EIt%20worked.%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2205001%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K148%20FLEXCAN%20Not%20transmitting%20on%20USB%20FD%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2205001%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Eyou%20have%20loopback%20mode%20enabled%20still%2C%20that's%20why%20you%20see%20message%20transmitted%20in%20debug%20mode.%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PetrS_0-1763106759493.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22PetrS_0-1763106759493.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F365662iE13C52CF87485507%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22PetrS_0-1763106759493.png%22%20alt%3D%22PetrS_0-1763106759493.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EUncheck%20this%20option%20and%20add%20Port_Init%20(NULL_PTR)%3B%20into%20your%20code%20to%26nbsp%3BInitialize%20all%20pins%20using%20the%20Port%20driver.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204594%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K148%20FLEXCAN%20Not%20transmitting%20on%20USB%20FD%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204594%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20Petr%2C%3C%2FP%3E%3CP%3EThanks%20for%20the%20feedback.%20I%20checked%20the%20registers%20during%20runtime%2C%20and%20here%E2%80%99s%20what%20I%E2%80%99m%20seeing%3A%3C%2FP%3E%3CP%3EESR1%3CSTRONG%3E%3A%3C%2FSTRONG%3E%20Bus%20is%20idle%2C%20synchronization%20bit%20is%20set%20(module%20is%20synchronized).%3C%2FP%3E%3CP%3EMCR%3A%3C%2FP%3E%3CP%3ELPMACK%20%3D%200%20-%20Not%20in%20low-power%20mode%3C%2FP%3E%3CP%3EFRZACK%20%3D%200%20-%20Not%20in%20freeze%20mode%3C%2FP%3E%3CP%3ENOTRDY%20%3D%200%20-FlexCAN%20is%20in%20normal%2Flisten-only%20mode%3C%2FP%3E%3CP%3EHALT%20%3D%200%20-%20No%20freeze%20request%3C%2FP%3E%3CP%3EMDIS%20%3D%200-%20Module%20is%20enabled%3C%2FP%3E%3CP%3EIFLAG1%3A%20After%20transmitting%2C%20BUF01%20becomes%201%3C%2FP%3E%3CP%3EBUF4TO1%3A%20Bit%201%20is%20set%2C%20confirming%20TX%20buffer%20interrupt%20flag%3C%2FP%3E%3CP%3ESo%20it%20looks%20like%20the%20controller%20is%20initialized%20correctly%20and%20transmission%20is%20happening%20from%20the%20MCU%20side.%3C%2FP%3E%3CP%3EI%20also%20verified%20that%20the%20CAN%20bit%20timing%20matches%20500%20kbps.%20I%E2%80%99ll%20try%20increasing%20RJW%20to%20the%20maximum%20value%20(4)%20as%20you%20suggested.%3C%2FP%3E%3CP%3Ethe%20MCU-side%20transmission%20call%20can_43_FlexCAN_write%20returns%20E_OK%20and%20I%20can%20see%20the%20TX%20buffer%20flag%20set%20in%20debugging%2C%20but%20no%20frames%20appear%20in%20the%20USB-CAN%20FD%20adapter%20tool.%3C%2FP%3E%3CP%3EI%E2%80%99ll%20check%20on%20the%20analyzer%20next%20to%20confirm%20whether%20any%20signal%20is%20actually%20going%20out%20on%20the%20CAN_TX%20pin.%3C%2FP%3E%3CP%3EAlso%20I'm%20using%20TJA1042%20transciever%20so%20I%20made%20STB%20pin%20low%20for%20making%20it%20normal%20mode.%3C%2FP%3E%3CP%3EDo%20i%20need%20to%20do%20anything%20extra%20for%20transmitting%3F%3C%2FP%3E%3CP%3Eif%20anything%20i%20left%20%2C%20let%20me%20know.%3C%2FP%3E%3CP%3EI%20have%20attached%20my%20project%20below.%3C%2FP%3E%3CP%3EThank%20you.%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2204530%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20S32K148%20FLEXCAN%20Not%20transmitting%20on%20USB%20FD%20tool%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2204530%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3ECAN%20bit%20timing%20looks%20correct.%20You%20can%20try%20to%20increase%20RJW%20to%20its%20max%20(4).%3CBR%20%2F%3ECAN%20clock%2048MHz%20can%20indicate%20FIRC%20is%20used%2C%20if%20yes%20select%20rather%20FXOSC%20or%20PLL%20running%20from%20FXOSC%2C%20due%20to%20its%20accuracy.%3CBR%20%2F%3EI%20am%20not%20clear%20of%20sentence%20%22%3CSPAN%3EThe%20CAN%20bus%20is%20synchronizing%20and%20everything%20is%20working%20on%20code%2C%20i%20am%20able%20to%20see%20transmission%20success%20through%20debugging%20but%20its%20not%20transmitting%20in%20USB%20CAN%20FD%20tool.%3C%2FSPAN%3E%22%3CBR%20%2F%3EDoes%20it%20mean%20CAN%20tool%20does%20not%20receive%20any%20message%20and%2For%20is%20not%20able%20to%20transmit%20any%3FHow%20do%20you%20check%20transmission%20success%20in%20debug%3F%3CBR%20%2F%3EDo%20you%20see%20message%20transmitted%20on%20bus%2C%20using%20scope%2Fanalyzer%3F%20Do%20you%20see%26nbsp%3B%3CSPAN%3Eerror%20detected%20(you%20can%20check%20ECR%2C%20ESR1%20registers)%3F%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBR%2C%20Petr%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E