AnsweredAssumed Answered

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

Question asked by jinshuai xu on Oct 15, 2017
Latest reply on Oct 18, 2017 by jinshuai xu

       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

Outcomes