CAN Initialization Problem KE06 - Processor Expert

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

CAN Initialization Problem KE06 - Processor Expert

Jump to solution
1,771 Views
lucaag
Contributor III

Hello,

 

I'm trying to use two FRDM-KE06Z boards to test a simple CAN application (bare metal style).

I've removed the SDA connection, and I'm debugging the appliction by the PE Micro Universal Multilink.

I've started the the main timer interrupt and it works fine, then I've added the CAN Initialization Routine, as it is generated by the Precessor Expert (included in the CodeWarrior vers. 10.6.4).

 

Unfortunately, the initialization routine doesn't exit from the initial state. It seems it tries to clear the INITRQ bit of the CANCTL0 register, but it doesn't succed. Entering the debugging mode I see that the application is looping checking the INITAK bit of the CANCTL1 register, which never goes to low state (please have a look to the attached picture).

I've tried to rewrite the Init routine following the KE06 user manual, but I've got bad results (unandled interrupt stop,...).

I also attach the simple configuration sets (all interrupts are disabled).

 

Can anybody help me? Any suggestion welcome...

 

Thank you very much in advance

 

Luca

Labels (1)
Tags (1)
1 Solution
1,498 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Luca,

Sorry it seems there is a bug in the generated code of  the function "CAN1_Init()",

it have not enable the TX interrupt . Please add this code into this function have

a try :

MSCAN_PDD_EnableTxMessageBufferInterruptMask(MSCAN_BASE_PTR,0X01U);

pastedImage_1.png

After add this word , then enable the "Don't Write Generated Component Moudules":pastedImage_3.png

Then build your project , have a try , if still have question , please contact me without any hesitate.

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

5 Replies
1,498 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Luca,

- There is example under CAN_LDD component , you can refer to it  :

pastedImage_1.png

- After refer to the Typical Usage , if still can not work , you can share your project to me , and i check it on my side for you .


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,498 Views
lucaag
Contributor III

Hello Alice,

hereby the last version which includes both TX/RX. As I mentioned, it sends the two frames only during the FRDM_KE06 initialization.

Best regards, Luca

0 Kudos
Reply
1,499 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Luca,

Sorry it seems there is a bug in the generated code of  the function "CAN1_Init()",

it have not enable the TX interrupt . Please add this code into this function have

a try :

MSCAN_PDD_EnableTxMessageBufferInterruptMask(MSCAN_BASE_PTR,0X01U);

pastedImage_1.png

After add this word , then enable the "Don't Write Generated Component Moudules":pastedImage_3.png

Then build your project , have a try , if still have question , please contact me without any hesitate.

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,498 Views
brunotremblay
Contributor III

Hi Alice and Luca,

I'm back from an absence of 6 month on a similar project using a couple (more then two) of FRDM-KE06Z board. Has you wrote earlier, I think I have a similar problem. When I try to use the code example of the typical use in the CAN_LDD help the interrupt never happen and the CAN controller send the same CAN frame indefinitely (continually).

I tried to add the : «MSCAN_PDD_EnableTxMessageBufferInterruptMask(MSCAN_BASE_PTR,0X01U); » instruction in the CAN1_Init() function but there’s no change.

I’m using Freemaster to see all the CAN registers and a CAN analyzer to monitor the CAN frame during debug but I’m a bit confuse on where to look to find what’s wrong. Beside the missing TX interrupt enable, is there something else?

Regards,

Bruno

0 Kudos
Reply
1,498 Views
lucaag
Contributor III

Hello Alice,

thank you again for your suggestion.

Unfortunately I'm still not able to make the system working. Be aware I'm trying to debug the application on a couple of boards FRDM_KE06Z.

So I've tried to write a simple application in two parts: the first one should send a frame after initialization as per the Processor Expert examples, the second one should wait for two frames after the intialisation. After theese operations, the two board should start to blink the led (the blue one the sender and the green one the receiver).

When I enter in debug mode, I see that the application loops waiting the flag  DataFrameTxFlg/DataFrameRxFlg to be set. Neither enter the interrupt. Once I remove the waiting of the flag, the led start to work regularly.

I don't know what is wrong... may be the bus should be taken off theBus Off condition...

So I forward the two simple projects. If you can have a look at your site, I'd be very greatful.

Thank you

Luca

0 Kudos
Reply