Anyone know an easy way to enable old flexcan driver over the new fsl_flexcan?

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

Anyone know an easy way to enable old flexcan driver over the new fsl_flexcan?

Jump to solution
2,283 Views
jamesmonczynski
Contributor II

I admit, I'm not that experienced with modifying the custom BSP based off of the twrk70f120m.

So, my legacy code uses the old flexcan driver (as opposed to the new fsl driver).

flexcan_mk70.c

kflexcan.c

kflexcan.h

kflexcan_int.c

When I try to add these files to the BSP, in the same "Peripheral_IO_Drivers\flexcan" folder, I get an error about adding files to a virtual folder.

So, I copied the files into my project, handled all compile errors, updated bsp.h to include appropriate files, and got the project to compile/link (minor warnings seen from bsp).

I tried out the project and CAN still does not work.

So, I think I'm missing something by not disabling the new fsl flexcan driver and not enabling the old flexcan driver.

Can someone point in the right direction to do this?

Thanks.

Tags (2)
0 Kudos
1 Solution
1,843 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

I recommend you study the following documents.

C:\Freescale\Freescale_MQX_4_1\doc\mqx\MQX_BSP_Porting_Guide.pdf

C:\Freescale\Freescale_MQX_4_1\doc\mqx\MQX_BSP_Porting_Example_User_Guide.pdf

The two documents described how to remove driver source files from BSP project, and how to add driver source files to BSP.

View solution in original post

0 Kudos
5 Replies
1,843 Views
jamesmonczynski
Contributor II

Update.

I am able to transmit CAN messages.

I can see the device's reply with a tool (Vehicle Spy 3).

But, I never get the receive interrupt with the message.

BTW, this same exact code works just fine under MQX v4.0.2

0 Kudos
1,843 Views
DavidS
NXP Employee
NXP Employee

Hi James,

The rub with the old flexcan drivers working with the newer MQX4.1.x is data types changed as well, and duplicate function declaration.

I'll attach all the files I touched into a ZIP that come from the MQX4.1.1 installation and specifically tested on the TWR-K70F120M.

I basically #defined out the new flexcan code in the fsl_flexcan_test.c and fsl_flexcan_test.h and replaced with the MQX4.0.1 test.c/.h code.

I then had to include flexcan_mk70.c, kflexcan_int.c, kflexcan.c, and kflexcan.h in the BSP->Peripheral_IO_Drivers->flexcan folder (simple drag-n-drop from the MQX4.0.1 path).

I also had to add one file (kflexcan.h) copy in the post build batch file to copy header file into the /lib path.

I did have to short R22 (signal PTC16 to edge connector for CAN1_RX signal) and R23 (signal PTC17 to edge connector for CAN1_TX signal) to allows signals to get to the TWR-SER card J5 header block.

Note I had to copy the flexcan_nk70.c file from MQX4.0.1 as it was not in the MQX4.1.1.

A screen shot of the files I touched is here:

ScreenHunter_71 Sep. 05 13.37.gif

I did test using 2 TWR-K70F120M tower kits with one setup as NODE 1 and the other NODE 2.

I also re-tested that I could change my #if 1 to #if 0 in the fls_flexcan_test.c source file to switch back to using the new flexcan driver.

The comment to that #if is

//DES 1=old flexcan driver test.c code, 0=new flexcan driver code

Hope this helps.

Regards,

David

1,843 Views
jamesmonczynski
Contributor II

David, thanks!

I found out , after reading, it is VERY simple to remove new and restore old.

The problem for me was not copying the files, but using links. I need to read better :smileyhappy:.

I found the typedef problems, easy enough.

So, just as I got your post email, I was testing and my old flexcan was working. Woohoo!.

So, now I will look at what you have done because future projects will use the new fsl method.

It will be nice to be able to switch back and forth to support legacy code and new development.

Thanks again.

0 Kudos
1,844 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi

I recommend you study the following documents.

C:\Freescale\Freescale_MQX_4_1\doc\mqx\MQX_BSP_Porting_Guide.pdf

C:\Freescale\Freescale_MQX_4_1\doc\mqx\MQX_BSP_Porting_Example_User_Guide.pdf

The two documents described how to remove driver source files from BSP project, and how to add driver source files to BSP.

0 Kudos
1,410 Views
LavanyaK
Contributor I

Hi 

There is no access to these files. Kindly help.

I am actually trying to integrate the updated CAN driver(fslcan.c abd fslcan.h), There are no build errors after integration but the communication is not happening via can. I mean I couldn't send CAN messages from machine to board. 

Kindly Help.

Thanks much!!

0 Kudos