Hi,
my test with RT1020-EVK
receiver file via CAN 500kbps.
Problems:
file 256k.....receiver 10k, 36, max 46k, and values the bytes in frame.
The interval between frames is 24,000 uS, and I use interrupt to save frames, then I can't time to reset the receiver and end up losing frames.
see:
code part:
static void flexcan_callback(CAN_Type *base, flexcan_handle_t *handle, status_t status, uint32_t result, void *userData)
{
switch (status)
{
case kStatus_FLEXCAN_RxIdle:
if (RX_MESSAGE_BUFFER_NUM == result)
{
can_temp.id = rxframe.id;
can_temp.length = rxframe.length;
can_temp.dataWord0 = rxframe.dataWord0;
can_temp.dataWord1 = rxframe.dataWord1;
rxframe.id = FLEXCAN_ID_STD(rxIdentifier);
rxXfer.mbIdx = RX_MESSAGE_BUFFER_NUM;
rxXfer.frame = &rxframe;
FLEXCAN_TransferReceiveNonBlocking(EXAMPLE_CAN, &flexcanHandle, &rxXfer);
rxComplete = true;
} else if (RX_MESSAGE_BUFFER_11 == result).....blablabla
-------------- save frames
CAN_BUF[bfifo_indx][i++] = can_temp.dataByte0;
CAN_BUF[bfifo_indx][i++] = can_temp.dataByte1;
CAN_BUF[bfifo_indx][i++] = can_temp.dataByte2;
-------------------------------------------
interrupt long time.
How to solved it.
Fifo + DMA how to ?
or other solution.
thanks,
Carlos.
Solved! Go to Solution.
hi Ma,
Solved problems!
FRAME: 01 E8 08 DC B2 AE AA AE AA AE AA <----error = memory sram onboard
not problems with CAN 500k, problems is memory problems save data.
saved data in Ram internal, no more problems.
thanks,
Carlos.
Hi,
problemas "interval" solved with CAN polling,
receiver file lenth ok.
now other problems.
bytes diferent in frames.
example:
FRAME: 01 E8 08 DC B2 AA AA AA AA AA AA
FRAME: 01 E8 08 DC B2 AE AA AE AA AE AA <----error
sdk
/* To get most precise baud rate under some circumstances, users need to set
quantum which is composed of PSEG1/PSEG2/PROPSEG. Because CAN clock prescaler
= source clock/(baud rate * quantum), for e.g. 84M clock and 1M baud rate, the
quantum should be .e.g 14=(6+3+1)+4, so prescaler is 6. By default, quantum
is set to 10=(3+2+1)+4, because for most platforms e.g. 120M source clock/(1M
baud rate * 10) is an integer. Remember users must ensure the calculated
prescaler an integer thus to get precise baud rate. */
calc quantum, 500000U and 1000000U is equal ?
FLEXCAN_GetDefaultConfig(&flexcanConfig);
flexcanConfig.baudRate = 500000U;
flexcanConfig.timingConfig.phaseSeg1 = 3;
flexcanConfig.timingConfig.phaseSeg2 = 2;
flexcanConfig.timingConfig.propSeg = 1;
problems is calc quantum ?
thanks,
Carlos
Hi Carlos,
First of all, sorry for the later reply.
So you did the FlexCAN tests based on MIMXRT1020-EVK board?
Have a great day,
Mike
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------
hi Ma,
Solved problems!
FRAME: 01 E8 08 DC B2 AE AA AE AA AE AA <----error = memory sram onboard
not problems with CAN 500k, problems is memory problems save data.
saved data in Ram internal, no more problems.
thanks,
Carlos.
Hi Carlos,
Glad to hear the issue was fixed.
Thanks for the sharing.
best regards,
Mike