Using FlexCAN with P&E Multilink on Kinetis K22

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

Using FlexCAN with P&E Multilink on Kinetis K22

1,025 Views
Sruss
Contributor II

I have 4 interconnected boards, all with Kinetis K22 processors communicating over FlexCAN.  When I use UART console, they communicate freely and correctly.  When I switch to Semihost console and use a P&E Multilink module connected to JTAG, they stop working. For example, I have a special board configured to respond to CAN RTR request for data. (Request data with message ID 0x1F0, receive 7 bytes of data with message ID 0x1F0.) When I send an RTR request for data from a board that uses UART console, I can see the RTR request at the special board, the special board sends back a message with 7 bytes of data, and I get back an ordinary CAN frame with 7 bytes of data at the UART-console board. When I send an RTR request for data from a board that uses Semihost console, I can see the RTR request at the special board, the special board sends back a message with 7 bytes of data.  However, the Semihost-console board never seems to see the reply. I have tried it numerous different ways and the bottom line is that the board does not receive CAN messages when it is in Semihost console (and when the debugger is plugged in and running in Debug mode). Also note that the MCR register settings are identical in UART versus Semihost -- it's not like the "FRZ" bit is set differently. Is there some "trick" to getting FlexCAN to work correctly in debug mode?

Labels (1)
0 Kudos
Reply
2 Replies

1,009 Views
diego_charles
NXP TechSupport
NXP TechSupport

Hi @Sruss 

I hope that you are doing excellent , I am sorry for the delay!

Semihost is an invasive debug technique that requires more additional flash and SRAM resources. Usually semihosting is not recommend for applications running on the field. Personally I would recommend using it only during a debug session, as it may provide a hard-fault when the application is running without a debug session. See this reference from the semihost hardfault file. 

diego_charles_0-1643953285169.png

However, you mention:  I have tried it numerous different ways and the bottom line is that the board does not receive CAN messages when it is in Semihost console (and when the debugger is plugged in and running in Debug mode). ... Is there some "trick" to getting FlexCAN to work correctly in debug mode?

I can not recall  problems to debug while using semi host  and FlexCAN examples on the FRDM-K64F . Also from your description I think that the FlexCAN works properly  when using UART console, correct? 

I think that you can simplify  the  problem investigation by testing how semi host works with FlexCAN , but setting a FLEXCAN loopback mode and therefore using a  single board. I am not sure of which MK22 variant do you have but probably you could take a look at the FRDM-K64F (MK64 FN of  1MB of flash and 120 MHz) FlexCAN loopback demo  as a reference.

Additionally it would be good to check what is the state of the board that no longer receives messages, if actually the FlexCAN does not get a message buffer, or if there is a stack overflow or another processor error.

Many thanks for your patience.

Diego.

0 Kudos
Reply

1,000 Views
Sruss
Contributor II

Thanks!  That helps me know what to do now.  I will shy away from Semihost for the "release" (field) version not so much because of CAN but because of Semihost in general.

If and when I get a chance, I might try some of your ideas, especially the loopback suggestion.