Suspicious Freescale recommended CAN-polling technique

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

Suspicious Freescale recommended CAN-polling technique

1,203件の閲覧回数
petpap
Contributor I

Freescales recommendations for polling of CAN-frames are as follows:

 

For each RX-MB where flag is raised:
    reset_flag();

    busy = 1;
    while (busy)
    {
        dummy = mbuff->CS.B.CODE; // locks MB
        busy = (uint8)(0x1 & dummy);
    }
    canId = mbuff->ID;  // extract canID from hardware 
    length = mbuff->CS.B.LENGTH;
    memcpy(data, (uint8*)mbuff->DATA.B, length);
    dummy = touCan->TIMER.R;   // releases lock of MB

 

This introduces a problematic while-loop. We do not want to let this loop potentionally run forever resulting in a watchdog-reset. At the same time limiting the loop so it runs maybe maxumum 10 times may result in lost CAN-frames. If we allow it to run longer, maybe 1000 times this could result in timing issues in our OS.

 

How should we proceed with this while-loop? Does anyone have any ideas it would be gratly appreciated!

 

Best regards,

Peter Pap

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

581件の閲覧回数
petpap
Contributor I

I forgot to add that we are using MPC5554 with a FlexCAN2-module!

0 件の賞賛
返信