how to program to let Flexcan can continuous send data on s32ds.

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

how to program to let Flexcan can continuous send data on s32ds.

ソリューションへジャンプ
3,452件の閲覧回数
jinshuaixu
Contributor V

       l set FLEXCAN baudrate is 250K.then if l send a frame,the needed time is calculate as folow:

      1000/(250*1000/8/16)=0.51 millisecond.

      Now, l do not want to send data through delay.l want to send data quilkly through read the status of register.such as follow(below code is error):

     while(1)

    {

        if (can0->milbox10->status==idle)

        {

             SendCANData(TX_MAILBOX, TX_MSG_ID, &ledRequested, 1UL);

        }

     }

     below is the mian file code ,l have upload the project.

     Thank you if you can help me.

 

int main(void)
{
/*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/
#ifdef PEX_RTOS_INIT
PEX_RTOS_INIT(); /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
#endif
/*** End of Processor Expert internal initialization. ***/

/* Do the initializations required for this application */
BoardInit();

GPIOInit();
FlexCANInit();

flexcan_data_info_t dataInfo =
{
.data_length = 1U,
.msg_id_type = FLEXCAN_MSG_ID_STD,
.enable_brs = true,
.fd_enable = true,
.fd_padding = 0U
};

/* Configure RX message buffer with index RX_MSG_ID and RX_MAILBOX */
FLEXCAN_DRV_ConfigRxMb(INST_CANCOM1, RX_MAILBOX, &dataInfo, RX_MSG_ID);

while(1)
{
SendCANData(TX_MAILBOX, TX_MSG_ID, &ledRequested, 1UL);
}

}

Original Attachment has been moved to: flexcan_encrypted.zip

ラベル(1)
タグ(1)
1 解決策
2,867件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

If using the same MB for transmissions, then you must be sure the MB is successfully transmitted before you are going to fill it again. So instead of delay you can use driver function

FLEXCAN_DRV_GetTransferStatus, for example as

 

/* Wait until the previous FlexCAN transmit is completed */

while(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, TX_MAILBOX) == STATUS_BUSY);

BR, Petr

元の投稿で解決策を見る

3 返答(返信)
2,868件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

If using the same MB for transmissions, then you must be sure the MB is successfully transmitted before you are going to fill it again. So instead of delay you can use driver function

FLEXCAN_DRV_GetTransferStatus, for example as

 

/* Wait until the previous FlexCAN transmit is completed */

while(FLEXCAN_DRV_GetTransferStatus(INST_CANCOM1, TX_MAILBOX) == STATUS_BUSY);

BR, Petr

2,535件の閲覧回数
HancenChen
Contributor II

Hi PrteS,

If I use the freeRTOS and flexcan to send multi-frames, how can I make sure all the messages can be transmit ted normally? Also use while() statement to get the status?

0 件の賞賛
返信
2,867件の閲覧回数
jinshuaixu
Contributor V

thank you for you helping.

0 件の賞賛
返信