Having trouble with my pi3 and slcand command to setup the carloop

like the title says I’m having trouble with my pi3 and slcand command to setup the carloop

heres a sample script I made to setup the carloop on startup.

#!/bin/bash
set -e
clear
program='Carloop'
echo $program Setup By DUBB45
ls /dev/ttyACM*
sleep .5
sudo slcand -o -c -s4 /dev/ttyACM* can0
sleep .5
sudo ip link set can0 up txqueuelen 1000
sleep .5
sudo ip link set can0 up txqueuelen 1000
sleep 1
ps aux | grep "$program" | grep -v grep > /dev/null
if [ $? -eq 0 ]; then
    killall -9 "$program"
fi
exit 0

I’ve set it up plenty of times on my PI0 but my first time using the PI3

I get this error

well not an error but I guess the way to use slcand

Usage: slcand [options] <tty> [canif-name]

Options: -o         (send open command 'O\r')
         -c         (send close command 'C\r')
         -f         (read status flags with 'F\r' to reset error states)
         -s <speed> (set CAN speed 0..8)
         -S <speed> (set UART speed in baud)
         -b <btr>   (set bit time register value)
         -F         (stay in foreground; no daemonize)
         -h         (show this help page)

Examples:
slcand -o -c -f -s6 ttyslcan0
slcand -o -c -f -s6 ttyslcan0 can0

I made this adjustment but gt an error

ls /dev/ttyS*
sleep .5
slcan_attach -w -o -f -s6 -c /dev/ttyS*

/dev/ttyS0
ioctl TIOCSETD: Device or resource busy

pi@raspberrypi:~ $ ls /dev/ttyS*
/dev/ttyS0

sudo slcan_attach -w -o -f -s6 -c /dev/ttyS0

I get this now

pi@raspberrypi:~ $ sudo slcan_attach -w -o -f -s6 -c /dev/ttyS0

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898607] Internal error: Oops: 80000007 [#1] SMP ARM

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898887] Process slcan_attach (pid: 19447, stack limit = 0xb4558210)

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898898] Stack: (0xb4559e10 to 0xb455a000)

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898912] 9e00:                                     804da0f4 b9a96d94 b4559e44 b4559e28

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898939] 9e20: 804da140 804e11f4 804da0f4 b476f400 00000000 a9705180 b4559e7c b4559e48

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898956] 9e40: 804c729c 804da100 00000041 00000000 00000000 00005423 b476f400 7ef8b664

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898972] 9e60: b4587240 b476f400 b4558000 00000000 b4559efc b4559e80 804c0680 804c7138

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.898988] 9e80: b93f5880 00000017 76e8e44b 804be7e4 b4559edc b4559ea0 804be7e4 804bdf98

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899004] 9ea0: 80719f98 8016af6c b91afe50 b960ed48 f6af4c89 b4587240 b4559f80 7ef8b650

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899021] 9ec0: b4559f80 00000002 b4558000 00000000 b4559f4c b4559ee0 8026f6cc 7ef8b664

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899065] 9ee0: b9baa828 b4587240 00005423 00000003 b4559f7c b4559f00 802835d4 804c00dc

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899085] 9f00: 80290230 80714eec b4587248 b6c56000 b4587240 b6c56000 b4587248 80270590

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899109] 9f20: 00000020 00000000 b4559f4c 00000002 b4587240 7ef8b650 b4559f80 80108244

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899146] 9f40: b4559f7c b4559f50 802705d0 8026f6a0 00000000 b4587240 7ef8b664 b4587240

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899189] 9f60: 00005423 00000003 b4558000 00000000 b4559fa4 b4559f80 80283d8c 80283534

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899207] 9f80: 0000000d 00000003 00000000 00000001 00000036 80108244 00000000 b4559fa8

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899223] 9fa0: 801080c0 80283d54 00000003 00000000 00000003 00005423 7ef8b664 0000000d

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899247] 9fc0: 00000003 00000000 00000001 00000036 7ef8b91b 00000000 00000000 00000001

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899272] 9fe0: 76e3ef20 7ef8b61c 00008920 76e3ef2c 60000010 00000003 00000000 00000000

Message from syslogd@raspberrypi at Sep 22 04:03:17 ...
 kernel:[ 2978.899555] Code: bad PC value
pi@raspberrypi:~ $ sudo slcan_attach  -s6 -c /dev/serial1

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611210] Internal error: Oops: 80000007 [#1] SMP ARM

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611485] Process slcan_attach (pid: 1918, stack limit = 0xb4f64210)

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611496] Stack: (0xb4f65e10 to 0xb4f66000)

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611510] 5e00:                                     804da0f4 b9a96d94 b4f65e44 b4f65e28

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611531] 5e20: 804da140 804e11f4 804da0f4 b89c6800 00000000 b8b894c0 b4f65e7c b4f65e48

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611547] 5e40: 804c729c 804da100 00000041 00000000 00000000 00005423 b89c6800 7eb5b684

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611563] 5e60: b88e0e40 b89c6800 b4f64000 00000000 b4f65efc b4f65e80 804c0680 804c7138

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611580] 5e80: b6939d80 00000017 76e9944b 804be7e4 b4f65edc b4f65ea0 804be7e4 804bdf98

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611596] 5ea0: 80719f98 8016af6c b920ccd0 b960ed48 f6af4c89 b88e0e40 b4f65f80 7eb5b670

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611612] 5ec0: b4f65f80 00000005 b4f64000 00000000 b4f65f4c b4f65ee0 8026f6cc 7eb5b684

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611628] 5ee0: b9baa828 b88e0e40 00005423 00000003 b4f65f7c b4f65f00 802835d4 804c00dc

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611644] 5f00: 80290230 80714eec b88e0e48 b9bb7000 b88e0e40 b9bb7000 b88e0e48 80270590

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611660] 5f20: 00000020 00000000 b4f65f4c 00000005 b88e0e40 7eb5b670 b4f65f80 80108244

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611676] 5f40: b4f65f7c b4f65f50 802705d0 8026f6a0 00000000 b88e0e40 7eb5b684 b88e0e40

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611692] 5f60: 00005423 00000003 b4f64000 00000000 b4f65fa4 b4f65f80 80283d8c 80283534

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611707] 5f80: 00000000 00000003 00000000 00000001 00000036 80108244 00000000 b4f65fa8

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611723] 5fa0: 801080c0 80283d54 00000003 00000000 00000003 00005423 7eb5b684 00000000

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611739] 5fc0: 00000003 00000000 00000001 00000036 7eb5b920 00000000 00000000 00000000

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611754] 5fe0: 76e49f20 7eb5b63c 00008920 76e49f2c 60000010 00000003 00000000 00000000

Message from syslogd@raspberrypi at Sep 22 04:18:30 ...
 kernel:[  118.611920] Code: bad PC value

and then

pi@raspberrypi:~ $ sudo slcan_attach -s6 -c /dev/serial0
attached tty /dev/serial0 to netdevice slcan1

sudo ifconfig slcan0 up

and bam its working now!!!

pi@raspberrypi:~ $ candump slcan0
  slcan0  123   [2]  12 34

revised script that I made for the Pi3

!/bin/bash
set -e
clear
program='Carloop'
echo $program Setup By DUBB45
ls /dev/serial*
sleep .5
sudo slcan_attach -s6 -c /dev/serial0
sleep 1
sudo ip link set slcan0 up txqueuelen 9000
sleep 1
ps aux | grep "$program" | grep -v grep > /dev/null
if [ $? -eq 0 ]; then
    killall -9 "$program"
fi
exit 0

sudo slcan_attach -w  -o -c  -s6  /dev/serial1 -n can1

pi@raspberrypi:~ $ sudo slcan_attach -w -o -c -s6 /dev/serial1 -n can1
attached tty /dev/serial1 to netdevice slcan0
rename netdevice slcan0 to can1 … ok.
Press any key to detach /dev/serial1 …

I have to open up a terminal the bring up the interface but its working. If anyone can help that would be awesome.

@dubb45, Can you clearly indicate what you still need help with?

JVanier is one of the experts integrating RPi with Particle. We can bring him since I have not worked enough with RPi yet.

sorry about all the posts I basically having trouble on the pi3.
the command sudo slcand -o -c -s6 /dev/ttyACM0 can0
doesn’t work on the pi3 anymore, from what I’ve read online due to the built in wifi/bluetooth
I’ve been trying to figure out of anyone else has been through this I’m not the greatest coder lol it looks like a mess of code but that little script stuff is working for me so far. in the meantime I’m switching back to my pi0&zero4u hub

@jvanier, Is this something you could answer?

I have this working if anyone needs it

#!/bin/bash
set -e
clear
program='CarloopPi3'
echo $program Setup by @dubb45
sudo slcan_attach -s6 -c /dev/serial1 -n dubb
sleep .5
sudo ip link set dubb up txqueuelen 9000
sudo ifconfig dubb
clear
echo $program is ready........

you can take off the "-n dubb " just thought it was cool to rename it something else besides can0 lol

Cool!

However, don’t take off the “-n dubb” but change “dubb” to “can0” or something suitable, as you do need to refer to the name lower down in the script…

oh yeah lol forgot about that if you take out the “-n dubb” by default it would be

sudo ip link set slcan0 up txqueuelen 9000