CAN not send

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CAN not send

1,283 Views
avppoian
Contributor I

I used the examples of twrk21f120m_flexcan_interrupt_transfer. I used two boards and communicate ok, but when I have other speed 250000Kbps and propagation segment 8 and time segment 1 = 3 and time segment 2 = 4 and resync jump width = 1 and time quanta per bit = 16. I send data but stay on while(!txcomplete). This is my application.

0 Kudos
Reply
4 Replies

1,108 Views
avppoian
Contributor I

I change the following to communicate to another board with can because it has this configuration in KDS 3.2.0. I changed this

config->timingConfig.phaseSeg1 = 3;
config->timingConfig.phaseSeg2 = 4;
config->timingConfig.propSeg = 8;
config->timingConfig.rJumpwidth = 1;

and the time quanta to 16.

Anybody can help me?

void FLEXCAN_GetDefaultConfig(flexcan_config_t *config)
{
/* Assertion. */
assert(config);

/* Initialize FlexCAN Module config struct with default value. */
#if (!defined(FSL_FEATURE_FLEXCAN_SUPPORT_ENGINE_CLK_SEL_REMOVE)) || !FSL_FEATURE_FLEXCAN_SUPPORT_ENGINE_CLK_SEL_REMOVE
config->clkSrc = kFLEXCAN_ClkSrcOsc;
#endif /* FSL_FEATURE_FLEXCAN_SUPPORT_ENGINE_CLK_SEL_REMOVE */
config->baudRate = 250000; //1000000U;
#if (defined(FSL_FEATURE_FLEXCAN_HAS_FLEXIBLE_DATA_RATE) && FSL_FEATURE_FLEXCAN_HAS_FLEXIBLE_DATA_RATE)
config->baudRateFD = 250000; //1000000U;
#endif
config->maxMbNum = 16;
config->enableLoopBack = false;
config->enableSelfWakeup = false;
config->enableIndividMask = false;
#if (defined(FSL_FEATURE_FLEXCAN_HAS_DOZE_MODE_SUPPORT) && FSL_FEATURE_FLEXCAN_HAS_DOZE_MODE_SUPPORT)
config->enableDoze = false;
#endif
/* Default protocol timing configuration, time quantum is 16. */
config->timingConfig.phaseSeg1 = 3;
config->timingConfig.phaseSeg2 = 4;
config->timingConfig.propSeg = 8;
config->timingConfig.rJumpwidth = 1;
}

0 Kudos
Reply

1,108 Views
avppoian
Contributor I

Not work yet. I did all the configurations. I can see on osciloscope but it stops on:

void Envia_CAN(uint32_t identificador, uint8_t message)
{
frame.id = txIdentifier; //FLEXCAN_ID_STD(txIdentifier);
frame.format = kFLEXCAN_FrameFormatStandard;
frame.type = kFLEXCAN_FrameTypeData;
frame.length = 8;
txXfer.mbIdx = TX_MESSAGE_BUFFER_NUM;
#if (defined(FSL_FEATURE_FLEXCAN_HAS_FLEXIBLE_DATA_RATE) && FSL_FEATURE_FLEXCAN_HAS_FLEXIBLE_DATA_RATE)
txXfer.framefd = &frame;
FLEXCAN_TransferFDSendNonBlocking(EXAMPLE_CAN, &flexcanHandle, &txXfer);
#else
txXfer.frame = &frame;
FLEXCAN_TransferSendNonBlocking(EXAMPLE_CAN, &flexcanHandle, &txXfer);
#endif

while (!txComplete)
{
};
txComplete = false;
}

0 Kudos
Reply

1,108 Views
avppoian
Contributor I

I watch on the oscilloscope and signal goes out by CAN_TX but the txcomplete never goes to one. What is happen?

0 Kudos
Reply

1,108 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi  Alexandre V.D.P.

I just modify the flexcanConfig.baudRate = 250000U;
The Node A of twrk21f120m_flexcan_interrupt_transfer seems able to send the first CAN message.
I have only one TWR-K21F120M board at the moment, so test it with CAN analyzer. Please make sure that both tower board was flashed with the newer baudrate program.

twrk21f120m_flexcan_interrupt_transfer.png

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply