CAN BUS on mangOH Red - simplified user experience

Please follow the instructions here:

Look forward to your feedback

@asyal

Many thanks. I will test it tomorrow morning and post my feed back.

:slight_smile:

Hello all,

This work very fine ! Great Job and thanks to theam.

I’am able to send/receive CAN message with socketcan api with my WP7607.
Legato 18.05.1

A solution to start the CAN with your application it’s to embedded the start_can.sh scrpit into your application. It’s a good way when you want to change CAN parameters (baudrate).

1 save to file start_can.sh and add into your project (root)

#!/bin/sh

export PATH=$PATH:/sbin

drv_file=`find /legato/systems/current/modules/ -name "*mcp251x.ko"`
drv=`basename $drv_file`
# remove the driver
rmmod $drv

# Take IoT card out of reset
echo 2 > /sys/class/gpio/export
echo out  > /sys/class/gpio/gpio2/direction
echo 1  > /sys/class/gpio/gpio2/value

# Enable level shifter on the CAN IoT card
echo 13 > /sys/class/gpio/export
echo out  > /sys/class/gpio/gpio13/direction
echo 1  > /sys/class/gpio/gpio13/value

# Bring driver back & iproute2 add in CAN
insmod $drv_file
ip link set can0 type can bitrate 125000 triple-sampling on
ifconfig can0 up
  1. add the following code and call it on COMPONENT_INIT {}

    void cant_start_sh (void)
    {
    char line[256];
    FILE* fp = popen(“start_can.sh 2>&1”, “r”);
    LE_ASSERT(fp != NULL);
    while (fgets(line, sizeof(line), fp) != NULL)
    {
    LE_INFO(“start_can.sh output: %s”, line);
    }
    int driverInitResult = pclose(fp);
    LE_FATAL_IF(!WIFEXITED(driverInitResult), “Could not run start_can.sh”);
    const int driverInitExitCode = WEXITSTATUS(driverInitResult);
    LE_FATAL_IF(driverInitExitCode != 0, “start_can.sh failed with exit code %d”, driverInitExitCode);
    }

Here some log of the can traffic. The apps send message 0x600 every 200ms.

and receive message 0x302 from my PC.

image

@asyal

This is my feedback:

CAN IoT driver work fine !
I start test for several day and let you inform about the result.

Thanks.

2 Likes

second day of test with new CAN IoT build and WP7607.
Any problem with very high traffic on the CANBUS (send/receive multi frame @50ms) Speed bus set to 500Kb/s.

Good !

1 Like

start_can.sh (889 Bytes)

Thank you team. Its working fine.
start_can.sh script attached. FYI.

1 Like

The best place to find the start_can.sh file is in the mangOH git repository under linux_kernel_modules/can_common/start_can.sh

Hello

My customer needs to use two CAN bus standards;
J1939 for collecting the data and KVP2000 for the control.
He will use MangOH red with WP7702 and Talon Iot Can card.

Can bus will work at 500kbps and with 50% of load. It looks we can support it with Legato for the answers here .

But this reference example has plenty of errors when compiling.

Could we get it without errors?
Thanks
Isabel