Adding can to freertos mpc5748g.

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

Adding can to freertos mpc5748g.

1,715 Views
Krishnaja
Contributor II

Hi,

I have added flexcan componentet to freertos_mpc5748g example. When I try to run, code is stuck in "SendCANData" function on the line "FLEXCAN_DRV_Send(INST_CANCOM1, mailbox, &dataInfo, messageId, data);".

 

Please tell me how to correct this and receive data over bus master. PFA of code main.

 

Krishnaja.

Tags (1)
0 Kudos
10 Replies

1,708 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

I created below example as new S32DS Application project and tested it on DEVKIT-MPC5748G board;

https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5748G-FlexCAN-TX-RX-FreeRTOS-S32DS2-1...

You can refer to it.

BR, Petr

0 Kudos

1,698 Views
Krishnaja
Contributor II

Hi,

I referred below example. I am not sure if "prvTransmitTask" task is working. When i pressed SW2 or SW4 I didnot get any data over busmaster. Please confirm it.

So to check whether data is sent by board, I added one new line:

if((recvBuff.data[0] == LED1_CHANGE_REQUESTED) &&
recvBuff.msgId == RX_MSG_ID)
{
/* Toggle output value LED1 */
PINS_DRV_TogglePins(LED_PORT, (1 << LED1));
SendCANData(TX_MAILBOX, TX_MSG_ID, 0x35, 1UL);

}

Again I am facing same issue, code is stuck in "SendCANData" function.

 

Krishnaja.

0 Kudos

1,662 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it works fine on my DEVIK revD1 and PCAN USB pro.
So when I pressed buttons I see received messages on PCAN View. Breakpoint is only working if I placed it on Can Send function. This could be due to optimization, I think.

Message send from CAN tool is received and LEDs are toggled.

Do you have bit timing properly set on your CAN tool?.

BR, Petr

0 Kudos

1,649 Views
PetrS
NXP TechSupport
NXP TechSupport

Also work if added SendCANData into receive task you have. But be sure pointer to data is used as 3rd parameter of SendCANData. You cannot use 0x35 you have\

BR, Petr

0 Kudos

1,644 Views
Krishnaja
Contributor II

Hi @PetrS ,

I am using ValueCAN3 - Intrepidsc.

Bus master screenshort.

Krishnaja_0-1621590080786.png

I am getting error message.

Krishnaja_1-1621590756393.png

I am able to send and receive data using CAN without freeRTOS. So I think bit timing is set on CAN  tool properly.

0 Kudos

1,637 Views
PetrS
NXP TechSupport
NXP TechSupport

example is using below bitrates...

arbitration phase: 500bit/s, 80%smp point
data phase: 2000 bit/s, 80%smp point

BR, Petr

0 Kudos

1,612 Views
Krishnaja
Contributor II

Hi @PetrS ,

I am able to send and receive data using flexcan.

Krishnaja_0-1621837967952.png

When I tried to run freeRtos project example link, my output is 

Krishnaja_1-1621839588465.png

Each time when i send a message from bus master, LED on/off alternatively. When i press SW2 or SW4 sometimes error message occurs.

I think bitrate is not an issue as it is working for normal project. As an RTOS a task  Tx from board is not working.

 

Regards,

Krishnaja.

0 Kudos

1,575 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

so both projects uses the same bitrate setting? If CAN tool detects error most probably this can be due to different bit timing setting.
If you think RTOS project does not send message, please check the FlexCAN registers an MB area to know
- MB is prepared for transmission
- check ESR1/ECR registers for eny kind of error detected.

BR, Petr

0 Kudos

1,591 Views
Krishnaja
Contributor II

Any other configuration changes needed for can on freertos??

PF images attached in previous post. Both can project and canfreertos example output as on busmaster.

0 Kudos

1,675 Views
Krishnaja
Contributor II

Any updates??

0 Kudos