Using MSCAN of FRDM-KEAZ64 board with Processor Expert

cancel
Showing results for 
Search instead for 
Did you mean: 

Using MSCAN of FRDM-KEAZ64 board with Processor Expert

958 Views
pilwonheo
Contributor I

Hello,

 

I am trying to establish CAN communication with the FRDM-KEAZ64 board using Processor Expert (in Kinetis Design Studio 3.2.0).

Because I successfully implemented other components like GPIO, ADC, AsynchroSerial, ..., I approached similarly; I added CAN_LDD component to the project and set it following the 'CAN_LDD Typical Usage' found in 'Help on Component'.

Especially, I started to try the section 'Sending data frame with interrupt service'. There are some differences between my actual project and the example settings as following:

   1. I defined two message buffers as provided as a default, unlike the only one message buffer set in the example.

   2. I changed the default pin settings to Rx: PTC6 and Tx: PTC7 as found in the schematic of the board.

   3. Receive buffer is message buffer no.1 and transmit buffer is message buffer no.2. (I left the default setting unchanged.)

 

But when I generated code and started debugging, it seems that the 'OnFreeTxBuffer' function is not called at all. So 'DataFrameTxFlg' remained 0 and therefore the process execution stuck to the line 'while (!DataFrameTxFlg) { }'.

 

The CAN_HI and CAN_LO pins in J13 on the board were connected to another CAN transceiver module which was set to receive data.

 

I wonder whether I missed some important steps or not... I attached the project files. Could you please suggest solution to my problem?

 

Thank you in advance.

Original Attachment has been moved to: test8-(FRDM_KEAZ64Q64).zip

Labels (1)
0 Kudos
4 Replies

309 Views
michaeljwilson
Contributor II

Hi all, I just made a post https://community.nxp.com/message/872143?q=CAN%20ISSUES describing the same issue. However, I followed the debugger stepping through and learned that it gets stuck in the PE_ISR routine for CAN. In loopback mode it doesn't get stuck. I also learned that Processor Expert actually forgets to autogenerate the "enable transmit interrupt" masking code needed to setup the registers. I have a CANAlyzer monitor to see what's going on and no frames are sent, not even in error. Could something be wrong with Processor Expert MSCAN Autoconfig?

0 Kudos

309 Views
pilwonheo
Contributor I

Hi,

I could not 'solve' this problem yet but I stopped trying it because I implemented another solution that does not use the on-board SBC (MCZ33903).

I guess that I may have misused the on-board SBC and that was causing the problem. I cut signal lines from MCU to the SBC and then attached another CAN transceiver (TJA1051) to 'opt out' the SBC.

Then everything worked fine! Too simple. I didn't change any code generated by the Processor Expert. It was just a hardware that matters. Maybe I could find a way to utilize the on-board SBC, but I didn't have enough time to play with the SBC.

Regarding the transmit interrupt: The transmit interrupt was not causing the problem (at least with the latest version of KDS) because the transmit interrupt is enabled in the SendFrame method, not in the Init method.

I hope this helps you.

0 Kudos

309 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello .

Could you please first use a CAN converter to check whether the board send data,

as this thread said CANBUS tool :https://community.nxp.com/message/606104 

If you have not CANBUS tool, please first use a logic analyzer to check whether it send signal.

If it send signal , maybe there is some problem in Receiver. If there isn't any signal, it meaning

the sender have not send data correctly .

BR

Alice

0 Kudos

309 Views
pilwonheo
Contributor I

Hello Alice,

Thanks for your reply.

I first checked whether the board (FRDM-KEAZ64) sends data or not, as you mentioned.

Because I don't have CAN bus tool, I hooked up the CAN_HI and CAN_LO pins on the board to an oscilloscope and watched what happens.

However it seems that no signal is sent from the board. I re-checked the settings of Processor Expert so that the CAN_LDD component uses PTC6 and PTC7, but still there was no signal.

Then I experimented some cases, after reading your suggested thread.

With Loop mode, all goes right. OnFreeTxBuffer is called and so the process exits while(!DataFrameTxFlg) { } loop successfully.

Then I disabled the Loop mode and I watched the SBC_CAN_TX signal with oscilloscope from TP21 on the board. It showed repeating signal pattern (even in paused status during debug) going between 0 and 1. So I guess that the MCU sends signal to the SBC (MCZ33903) but the SBC keeps silent.

Did I miss some hardware settings? I powered the board with USB and I connected J3 pin 15 (VIN) to J3 pin 9 (P5V0) to supply power to the SBC from OpenSDA's regulated 5V output. A shunt at J107 was placed between pin 2-3 (default position).

Update: Powering the board with external 12 V adapter via barrel socket (J16) instead of USB did not change any behavior. The CAN signal remained silent, while SBC_CAN_TX presented repetitive signal.

I'll look forward to your help.

Thank you.

0 Kudos