CAN to LIN conversion

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

CAN to LIN conversion

8,013 Views
pankajrana
Contributor III

hi,

Working with iMx6-solo is it possible to use LIN Bus interface.?

Is it possible to use the LIN bus interface through the CAN interface available in the processor? or any other possibilities ?

Thanks.

Regards,

Pankaj Rana

Labels (1)
10 Replies

4,345 Views
fatalfeel
Contributor V

new source download

Programming Guide: Uart to LinBus 

here is blogger and modify iplink reopen crash bug

can-utils use

version

Author: Oliver Hartkopp <socketcan@hartkopp.net>  2012-07-22 19:06:06
Committer: Oliver Hartkopp <socketcan@hartkopp.net>  2012-07-22 19:06:06

can pass param to swicth master slave and baud rate

0 Kudos

4,345 Views
fatalfeel
Contributor V

if you use canutils u need roll back to fit sllin

GitHub - linux-can/can-utils: Linux-CAN / SocketCAN user space applications 

version

Author: Oliver Hartkopp <socketcan@hartkopp.net>  2012-07-22 19:06:06
Committer: Oliver Hartkopp <socketcan@hartkopp.net>  2012-07-22 19:06:06

0 Kudos

4,345 Views
fatalfeel
Contributor V

4,345 Views
fatalfeel
Contributor V

if use slcan_attach and modify it to sllin_attach

Terminal one
root@matrix_io:/ # sllin_attach -w /dev/ttymxc2                            
[ 1011.794896] sllin: sllin_open() invoked
[ 1011.795496] sllin: Configured as MASTER
[ 1011.796026] sllin: Baudrate set to 19200
attached tty /dev/ttymxc2 to netdevice sllin0
Press any key to detach /dev/ttymxc2 ...
//now do not press anykey

Terminal Two:

adb shell

su

find . -print | grep -i 'sllin0'

./sys/devices/virtual/net/sllin0
./sys/devices/virtual/net/sllin0/mtu
./sys/devices/virtual/net/sllin0/type
./sys/devices/virtual/net/sllin0/phys_port_name
./sys/devices/virtual/net/sllin0/netdev_group
./sys/devices/virtual/net/sllin0/flags

//success too

0 Kudos

4,344 Views
fatalfeel
Contributor V

File sharing and storage made simple 

put it in myandroid/external to build

0 Kudos

4,344 Views
fatalfeel
Contributor V

sllin.c copy to kernel_imx/drivers/net/can


in Kconfig

### begin: issue  ###
config CAN_SLLIN
    tristate "Serial / UART serial CAN Adaptors (sllin)"
    ---help---
      slLIN is TTY line discipline implemented for Linux operating
      system that handles the interchange of LIN messages between
      the underlying UART driver and the CAN bus subsystem.
### end: issue  ###

in Makefile add

obj-$(CONFIG_CAN_SLLIN)        += sllin.o

in Default config

/kernel_imx/arch/arm/configs/mx6dq_XXXXX_android_defconfig

### begin: issue  ###
CONFIG_CAN_SLLIN=y
### end: issue  ###

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

success use and need mark some lines and let it compile pass
https://github.com/karelzak/util-linux/blob/master/sys-utils/ldattach.c

in Android.mk
include $(CLEAR_VARS)

LOCAL_SRC_FILES := ldattach.c
LOCAL_MODULE := ldattach
LOCAL_MODULE_TAGS := optional
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/
LOCAL_CFLAGS := $(PRIVATE_LOCAL_CFLAGS) -DHAVE_NANOSLEEP

include $(BUILD_EXECUTABLE)

0 Kudos

4,345 Views
fatalfeel
Contributor V

linux-lin/sllin at master · trainman419/linux-lin · GitHub 

and full resource of sllin
https://rtime.felk.cvut.cz/can/lin-bus/

Sllin is TTY discipline enabling you to create LIN Master (and partially LIN Slave) out of your computer.
Hardware needed is Hardware UART embedded into the computer + simple voltage level LIN converter.
0 Kudos

4,345 Views
Pavel
NXP Employee
NXP Employee

You can use UART controller for LIN communication. The LIN protocol is UART base protocol.

See the following pages

(http://rtime.felk.cvut.cz/can/sllin-rtlws14-paper.pdf)

(http://www.mikroe.com/downloads/get/1507/lin_manual_v100.pdf)

(http://en.wikipedia.org/wiki/Local_Interconnect_Network).

Find also the LINOVERVIEWPRESENT.ppt document from Freescale in internet.

4,345 Views
pankajrana
Contributor III

Hi Pavel,

Thanks for your reply.

Using the UART interface of iMX6-SOLO for LIN ?

LIN BUS supports 16 slaves , but whereas UART interacts with one device only. So won't this affect the working ? Also the slave addresses will come into account .

I came across some of the RS232-LIN convertors but in the implementation circuit they have used MCUs that support LIN protocol. In iMX6 processors I have not seen any provision for LIN , so I am little worried on it.!

-Pankaj Rana

0 Kudos

4,345 Views
Pavel
NXP Employee
NXP Employee

LIN transceiver supports using a few slaves on the LIN bus.

You software should supports 16 slaves. Your software should support LIN Frames. LIN frames provides support 16 slaves. See LIN specification.

See also the following pages

(http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2633.pdf)

and

(http://cache.freescale.com/files/microcontrollers/doc/app_note/AN2575.pdf)