title: write: no buffer space available socket-can/linux-can
body: <p>I'm running a program with two CAN channels (using TowerTech CAN Cape TT3201). </p>
  
  <p>The two channels are can0 (500k) and can1 (125k). The can0 channels works perfectly but can1 runs a write:No buffer space available error. </p>
  
  <p>I'm using ValueCAN3/VehicleSpy to check the messages. </p>
  
  <p>This is before I run the program. can0 and can1 both seem to send, but only can0 shows up in VehicleSpy. </p>
  
  <pre><code>root@cantool:~# cansend can0 100#00 
  root@cantool:~# cansend can1 100#20
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/bg8ME.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bg8ME.png" alt="enter image description here"></a></p>
  
  <p>This is after I try running the program </p>
  
  <pre><code>root@cantool:~# cansend can1 100#20 
  write: No buffer space available 
  root@cantool:~# cansend can0 111#10
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6Ffoh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/6Ffoh.png" alt="enter image description here"></a></p>
  
  <p>While my program is running : I get this error for all messages to be sent on can1 </p>
  
  <pre><code>2016-11-02 15:36:03,052 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    12f83018    010    1    00 
  2016-11-02 15:36:03,131 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    0af81118    010    6    00 00 00 00 00 00 
  2016-11-02 15:36:03,148 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    12f81018    010    6    00 00 00 00 00 00 
  2016-11-02 15:36:03,174 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    0af87018    010    3    00 00 00 
  2016-11-02 15:36:03,220 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    12f89018    010    4    00 00 00 00 
  2016-11-02 15:36:03,352 - can.socketcan.native.tx - WARNING - Failed to send: 0.000000    12f83018    010    1    00 
  </code></pre>
  
  <p>However sometimes the whole program works perfectly (if the module is rebooted or some random instances). </p>
  
  <p>How do I fix this? </p>
  
  <pre><code>root@cantool:~# uname -r 
  4.1.15-ti-rt-r43
  </code></pre>
  
  <p>after doing some digging, I found this</p>
  
  <pre><code> root@cantool:-#ip -details link show can0
   4:can0: &lt;NOARP,UP,LOWER_UP, ECHO&gt; mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
        link/can promiscuity 0
        can state ERROR-ACTIVE (berr-counter tx 0 rx 0) restart-ms 100
        bitrate 500000 sample-point 0.875
        tq 125 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
        c_can: tseg1 2..16 tseg2 1..8 sjw 1..4 brp 1..1024 brp-inc 1
        clock 24000000
   root@cantool:-#ip -details link show can1
   5: can1: &lt;NOARP,UP,LOWER_UP, ECHO&gt; mtu 16 qdisc pfifo_fast state UNKNOWN mode DEFAULT group default qlen 10
        link/can promiscuity 0
        can state STOPPED restart-ms 100
        bitrate 125000 sample-point 0.875
        tq 500 prop-seg 6 phase-seg1 7 phase-seg2 2 sjw 1
        c_can: tseg1 2..16 tseg2 2..8 sjw 1..4 brp 1..64 brp-inc 1
        clock 8000000
  </code></pre>
  
  <p><strong>Turns out that can1 is STOPPED for some reason</strong></p>
  
  <p>however when I try:</p>
  
  <pre><code>ip link set can1 type can restart 
  RNETLINK answers: Invalid argument
  </code></pre>