How to use CAN drivers with FreeRTOS?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to use CAN drivers with FreeRTOS?

3,811件の閲覧回数
skyguy
Contributor III

In order to use CAN with FreeRTOS, I have replaced the interrupt handler with my own that includes a semaphore for task switching.  I've modified the function MCAN_TransferCreateHandle in fsl_mcan.c in the SDK as follows:

//s_mcanIsr = MCAN_TransferHandleIRQ;
s_mcanIsr = can_TransferHandleIRQ_FreeRTOS;

I also have added the header for my code file to fsl_mcan.c.  I'm doing this because s_mcanIsr is defined within the module as a static variable and is used by other driver functions.  I really want to do this in a way that does not modify the fsl_mcan driver.  Is there another way to do this without modifying the driver?

Thanks,

Rick

0 件の賞賛
返信
3 返答(返信)

3,161件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Rick:

Could you please let me know which device you are using and the SDK version?

Regards

Daniel

0 件の賞賛
返信

3,161件の閲覧回数
skyguy
Contributor III

Hi, Daniel,

I'm targeting the LPC54618J512 (208 pin package) and using SDK version 2.4.0.

Thanks,

Rick

0 件の賞賛
返信

3,161件の閲覧回数
danielchen
NXP TechSupport
NXP TechSupport

Hi Rick:

For my understanding, the FreeRTOS driver is a wrapper built on top of standard SDK peripheral drivers.

The wrappers provide an API which blocks the calling task until the I/O operation completes and allows other tasks to run. This is achieved by using the asynchronous API of the underlying driver along with RTOS task synchronization object.

You can refer to the FreeRTOS usart driver in SDK installation folder.

LPCXpresso54618\devices\LPC54618\drivers\fsl_usart_freertos.c

LPCXpresso54618\devices\LPC54618\drivers\fsl_usart.c

Regards

Daniel

0 件の賞賛
返信