Flexcan example on tower K60

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

Flexcan example on tower K60

7,630 Views
Abhitechmania
Contributor IV

Hello all,

 

I have just started trying the tower system (K60) for Keil development environment. I have successfully used UART on SER but I am facing problems with CAN on SER board. The keil has successfully built the flexcan example. I have also made necessary jumper changes on SER (shunting between 5-6 and 7-8). The terminal utilty also shows that data is being transmitted

"Data transmit: 1                                                              

FLEXCAN tx update message. result: 0x0"

But I dont see any activity on pin 1 and 3 of J7 using oscilloscope. 

Could you help out with this.

 

Thanks in advance,

Abhinav

Tags (2)
22 Replies

5,111 Views
sruthyuk
Contributor I

Hi Luis,

Did you tested CAN communication between two tower boards or between two CAN module in MK60F512 tower board??Is there any sample code for testing CAN communication in KDS2.0??

With regards,

sruthy uk

0 Kudos

5,111 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

Between two [TWR-K60 + TWR-SER]

Code is for MQX and MQX 4.2 supports KDS. So you should be able to run the same code.

Best Regards,

Luis

0 Kudos

5,111 Views
sruthyuk
Contributor I

Hi,

But this code is for MQX project. This code cant be used in my project.

with regards

sruthy uk

0 Kudos

5,111 Views
CCandido
Contributor V

Hi All,

warning, in my tests was proven,
tja1050 (5v) causes reset on ARM Kinetis.
reason: PIN4_RXD = 5v.

thanks,

Carlos.

0 Kudos

5,110 Views
mjbcswitzerland
Specialist V


Carlos

Which Kinetis processor are you using? They generally accept -0.3V..+5.5V on digital inputs and so the TWR-SER will work with CAN processors. If you get a reset it is probably due to something else.

Regards

Mark

Kinetis: http://www.utasker.com/kinetis.html
Kinetis K60:
- http://www.utasker.com/kinetis/TWR-K60N512.html
- http://www.utasker.com/kinetis/TWR-K60D100M.html
- http://www.utasker.com/kinetis/TWR-K60F120M.html
- http://www.utasker.com/kinetis/ELZET80_NET-KBED.html
- http://www.utasker.com/kinetis/ELZET80_NET-K60.html

CAN: http://www.utasker.com/docs/uTasker/uTaskerCAN.PDF
FlexCAN video: https://youtu.be/Ha8cv_XEvco

Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M

Professional Kinetis support, one-on-one training and complete fast-track project solutions: http://www.utasker.com/support.html

0 Kudos

5,110 Views
CCandido
Contributor V

hi Mark,

I took a minimum of three years, believed in this information, that it tolerates 5v, and my projects with K2x, always gave restart problems, and I could not know the source of the reset, until one day to a pcb without the CAN_TJA1050, I realized that reboots alone. well there I did the tests, and for me it was proven (PIN4_RXD = 4.8v) restart Kinetis. who wants to use ok, but I left here as an alert if you have problems.

thanks,

Carlos.

0 Kudos

5,111 Views
sruthyuk
Contributor I

Hi friend

Could you please post the example code for testing flexcan  by enabling loop back mode used in TWR-K60F120M and the steps for testing CAN?? I have been trying to test the flexcan1 using can_loopback_node codeflexcan testing in TWR-K60F120M by writing a character through uart5 and reading it in the console, but have no ideas yet now. Also tell the jumper setings in TWR SER and pins in elevator you have used.

With Regards

Sruthy uk

0 Kudos

5,107 Views
Abhitechmania
Contributor IV

I mistakenly wrote pins 1-2 of J7. It should be pins 1-2 of J5 (see reply next to that). A nice explanation is given by Robert in the latest message. 

5,107 Views
unmannedrussery
Contributor II

Update... FIXED!

The problem is with the TWR SER jumper setup specified in TWRSERUM.pdf (or at least my interpretation of that setup). The table for J5 says shorting pins 1-2 "Put[s] CAN transceiver into sleep mode". This is actually incorrect.

Installing this jumper connects the "S" pin on the transceiver to ground, which puts the transceiver into normal operation or high speed mode (see pg. 4 of the datasheet http://www.nxp.com/documents/data_sheet/TJA1050.pdf).

So for this demo to work, you must short pins 1-2 of J5 on the TWR SER board. I had tried this earlier, but was doing it with a loose piece of wire (I'm short on 0.1" jumpers), and must not have had the two pins shorted effectively.

Regards,

-Robert

5,107 Views
unmannedrussery
Contributor II

Abhinav or others... Did you ever get a specific solution to this problem? I've been playing around with the FlexCAN demo all day on MQX 3.8 without any success. As others have commented, the terminal output is pretty unhelpful... it says that setup succeeded and that the message is transmitting correctly:

*********FLEXCAN TEST PROGRAM.*********
Message format: Standard (11 bit id)
Message buffer 0 used for Tx and Rx.
Interrupt Mode: Enabled
Operation Mode: TX and RX --> Normal
***************************************

selected frequency (Kbps) is: 125
Data length: 1
FLEXCAN reset. result: 0x0
FLEXCAN initilization. result: 0x0
FLEXCAN mode selected. result: 0x0
FLEXCAN global mask. result: 0x0
FLEXCAN Error ISR install, result: 0x0
FLEXCAN Bus off ISR install, result: 0x0
FLEXCAN error interrupt enable. result: 0x0
FLEXCAN rx remote mailbox initialization. result: 0x0
FLEXCAN rx mailbox initialization. result: 0x0
FLEXCAN mailbox activation. result: 0x0
FLEXCAN RX ISR install. result: 0x0
FLEXCAN RX remote ISR install. result: 0x0
FLEXCAN tx remote mailbox initialization. result: 0x0
FLEXCAN tx mailbox initialization. result: 0x0
FLEXCAN tx mailbox activation. result: 0x0
FLEXCAN TX ISR install. result: 0x0
FLEXCAN TX remote ISR install. result: 0x0
FLEXCAN started. result: 0x0
Data transmit: 0
Data transmit: 1
FLEXCAN tx update message. result: 0x0
Data transmit: 2
FLEXCAN tx update message. result: 0x0
Data transmit: 3
FLEXCAN tx update message. result: 0x0

I think the software end of it is working correctly, as I'm able to see the message data increment in the mailbox register (0x400A_4058) if I view memory while running the code. I've tried putting a logic analyzer on pin 42 of the A-side expansion port, but the signal doesn't change (sampled at 1MHz for 5 seconds) and the bus just stays high.

I've established that the CAN transceiver works correctly by stimulating pins 1 and 3 of J7 on the TWR-SER with a CAN-USB module. I'm able to view the data stream on the A-side expansion port, Pin 41 (CAN_RX). However, the FlexCAN demo code doesn't acknowledge receipt of the message (sent with message id 0x123).

Are there any known issues with the TWR-K60N512 or TWR-SER that would prevent the FlexCAN demo from working out of the box? I've tried the following with no success:

- K60 Mask set 0M33Z errata fix e2583, by placing "OSC_CR |= OSC_CR_ERCLKEN_MASK;" at line 333 of kflexcan.c.

- Shorting pins 1-2 of J7, as suggested by Abhinav.

Any advice or experience would be greatly appreciated!!

Robert

0 Kudos

5,104 Views
LANCO_M4
Contributor II

I think I am haivng the same problem with my tower. Is there a solution? I am little confused by the statement "Now that I incorporated it worked fine" what was incorporated?

0 Kudos

5,104 Views
Abhitechmania
Contributor IV

srry its J5..

5,108 Views
Abhitechmania
Contributor IV

Thanks Luis,

I did not see an errata for CAN. Now that I incorporated it worked fine. One thing more Contrary to what is mentioned in user manual, pin 1-2 of J7 should be shunted to activate the can driver IC. 

 

Kind regards,

Abhinav

0 Kudos

5,108 Views
LuisCasado
NXP Employee
NXP Employee

Hi,

 

As far as I know, No. Check the IOMUX configuration for CAN pins.

Recheck you are using CAN1 interface in the PTE24, PTE25 pins and also check pin B42 in the elevator.

 

Best Regards,

0 Kudos

5,108 Views
Abhitechmania
Contributor IV

no, there is no acitvity on pin 1 C_TXD (TJA1050) also. It gives an constant voltage of 3.3 volts. I tried the same demo but with code warrior but still nothing. Is there any hardware bug in the tower system ? FYI, I have 

TWR-K60: 700-26548 REV A & SCH-

26548 REV C

 

Regards,

Abhinav

0 Kudos

5,108 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

Can you measure activity in pin 1 C_TXD (TJA1050)?

 

Best Regards,

0 Kudos

5,108 Views
LuisCasado
NXP Employee
NXP Employee

H

0 Kudos

5,108 Views
Abhitechmania
Contributor IV

has anyone got flexcan demo working? I donot get any output from J7 pin 1 and 3. The program is running fine in debug mode but there is no signal on J7. 

0 Kudos

5,108 Views
Abhitechmania
Contributor IV

Thanks Luis, It works fine. I have few more questions

1. Does the can message is available on J7 pin 1 &3 in loopback mode? 

2. Can you tell me the setting of jumpers of tower(K60) and SER and other settings to get flexcan running? I will use can analyzer from vector (http://www.vector.com/vi_cancardxl_en.html) .

Regards,

Abhinav

5,108 Views
LuisCasado
NXP Employee
NXP Employee

Hello,

 

I think the example needs an external CAN node. Try the attached example implementing loopback mode for testing.

 

Luis

0 Kudos