AnsweredAssumed Answered

Problem on KDS with CAN_LDD driver code for FlexCAN

Question asked by Alessandro Vagniluca on Nov 11, 2014
Latest reply on Jan 7, 2015 by Carlos Chavez

I ported my K60-based application from CW 10.4 + MQX 4.0.2 to KDS 1.1.1 + MQX 4.1.1.

My BSP is based on PEx and my application uses both FlexCAN channels. For each of them I use a CAN_LDD driver.

But my test code on both CAN channels does not work any more.

The generated CAN_LDD driver code differs from my previous I got with CW 10.4 essentially on the SendFrame function (the FlexCAN peripheral is initialized in the same mode).

 

I attach my test code and the ProcessorExpert project of my BSP.

On my board one CAN channel port is connected with the other CAN channel port and my code does the following:

  1. Init CAN_LDD driver on both channels in the same mode.
  2. Send a packet from the first CAN port and, after 300 msec, check its reception on the second CAN port.
  3. Send a packet from the second CAN port and, after 300 msec, check its reception on the first CAN port.

 

With my firmware compiled with CodeWarrior 10.4 and MQX 4.0.2 the test result is ok (so my hardware is good).

The test fails with my new firmware compiled with KDS 1.1.1 and MQX 4.1.1.

 

Some notes:

  • All the other function of my KDS firmware are working properly (GPIO, UART, ADC, SPI, I2C, etc.) as with my CW firmware. So I can say my BSP library is good.
  • I tried to incremet up to 2 sec the reception waiting time, but this does not fix the issue.
  • All the CAN_LDD driver functions return without errors (except when ReadFrame function returns ERR_RXEMPTY).
  • With my scope I see that no packet is output from both the CAN channels when I call the SendFrame function.
  • My test passes only if I execute my application with the debugger and with a breakpoint set at the following line of the SendFrame function (in both drivers):

CAN_PDD_SetMessageBufferCode(CAN1_BASE_PTR, BufferIdx, TxMBCode); /* Set code for Tx buffer of the message */

This is very strange: how can the debugger breakpoint unblock the frame transmission on the CAN driver?


Can you help me to fix this issue?

 

Best Regards,

Alessandro

Original Attachment has been moved to: TestCAN.zip

Outcomes