CAN setup on K66 for inbound/outbound heavy load

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

CAN setup on K66 for inbound/outbound heavy load

529件の閲覧回数
talledo
Contributor I

Trying to setup a multi transmitter/receiver for CAN using both CAN0/CAN1 interfaces on K66. Pretty much a gateway implementation.

I would like to know what recommendations/suggestions you can provide in order to use the multi Mailbox implementation for Tx/Rx over CAN. Does the driver take care of selecting the available Mailbox for TX or RX or it is the user responsible for this?

What about best setup for Masking/Filtering. Because all the messages coming in should be processed, what is the easy setup for this?

Thanks in advance

0 件の賞賛
返信
1 返信

461件の閲覧回数
mjbcswitzerland
Specialist V

Hi Jean

The FlexCAN has 16 buffers that can be configured as either receive or transmit buffer. There are three filters for the reception (buffers 14 and 15 have their own filters and all others share a third filter). To receive all IDs simply ensure that the filter masks are set to 0.


In the uTasker project the FlexCAN setup allows each receiver ID to be configured and the number for buffers for rx and tx to be set as follows (for example, 2 tx buffers and 3 rx buffers at each interface with unique ID matching):

    static QUEUE_HANDLE CAN_interface_ID0 = NO_ID_ALLOCATED;
    static QUEUE_HANDLE CAN_interface_ID1 = NO_ID_ALLOCATED;

    CANTABLE tCANParameters;                                             // table for passing information to driver

    tCANParameters.Task_to_wake = OWN_TASK;                              // wake us on buffer events
    tCANParameters.Channel = 0;                                          // CAN0 interface
    tCANParameters.ulSpeed = 1000000;                                    // 1 Meg speed
    tCANParameters.ulTxID = (CAN_EXTENDED_ID | 0x00000105);              // our partner's ID on the bus (extended)
    tCANParameters.ulRxID = 0x102;                                       // our standard rx ID on the bus (not extended)
    tCANParameters.ulRxIDMask = CAN_STANDARD_MASK;                       // use all standard bits for compare
                                                                         // use all bits for compare
    tCANParameters.usMode = 0;                                           // use normal mode
    tCANParameters.ucTxBuffers = 2;                                      // assign two tx buffers for use
    tCANParameters.ucRxBuffers = 3;                                      // assign three rx buffers for use
    CAN_interface_ID0 = fnOpen(TYPE_CAN, FOR_I_O, &tCANParameters);      // open interface


    tCANParameters.Channel = 1;                                          // CAN1 interface
    tCANParameters.ulTxID = 0x102;                                       // default ID of destination (not extended)
    tCANParameters.ulRxID = (CAN_EXTENDED_ID | 0x00000105);              // our ID (extended)
    tCANParameters.ulRxIDMask = CAN_EXTENDED_MASK;
    CAN_interface_ID1 = fnOpen(TYPE_CAN, FOR_I_O, &tCANParameters);      // open interface

For all reception matching, tCANParameters.ulRxIDMask can be set to 0.
For 12 Rx buffers and 4 tx buffers one would use

    tCANParameters.ucTxBuffers = 4;                                      // assign four tx buffers for use
    tCANParameters.ucRxBuffers = 12;                                     // assign twelve rx buffers for use

etc.

See dual flexCAN video at https://www.youtube.com/watch?v=Ha8cv_XEvco

Regards

Mark

Complete Kinetis solutions for professional needs, training and support: http://www.utasker.com/kinetis.html
Kinetis K66:
- http://www.utasker.com/kinetis/TWR-K65F180M.html
- http://www.utasker.com/kinetis/FRDM-K66F.html
- http://www.utasker.com/kinetis/TEENSY_3.6.html
uTasker: supporting >1'000 registered Kinetis users get products faster and cheaper to market
Request Free emergency remote desk-top consulting at http://www.utasker.com/services.html

Open Source version at https://github.com/uTasker/uTasker-Kinetis

CAN: http://www.utasker.com/docs/uTasker/uTaskerCAN.PDF

0 件の賞賛
返信