P1 Single-wire CAN question

Hello This thing amazing thank you for making it. I just need to know how to use it with a GM swcan. I guess I should type something like config-pin P1_28 can and config-pin P1_26 can. But what are these commands for swcan? Or is there any other way? I made it work work flawlessly with a Jeep.

What are you trying to do? You can use Savvy Can and it is included as a supported buss.

I want to send some commands to the car using python and command line. Similar to the official P1 tutorial. Like I said it worked with config-pin commands on a Jeep but I need config-pin for GM or some other way to send anything via command line.

Well once you have it set up to send and receive data in that pin (pin 1 swcan, 4/4 ground, 16 12v if I remember) the serial speed is typical with a baud of 33 and can have to write and/or install fw to interpret the analog signal to digital… What I have found to be much easier is to use firmata to control how the device configures its pins, and then use a linux system to interpret the serial data coming in. So you can use the firmata python library to control the macchina hardware and do your logic and heavy lifting on a Linux machine. Try to do it through compiling and then being stuck with whatever it has has been a source of pain for me at least and how I use it. One day I am working on gm, the next maybe I’m working on a Ford. Switching the fw out to suit the use can be done via the host machine, but controlling the device on the fly seems to work out best for me, and has given the most flexibility. Though I’m sure others on here may have some magic to make it work better than I have mine. I’ve only had my m2 (interface and mcu board) for about a month. Still learning. :slight_smile:

I missed that the OP was talking about the P1. There is a thread here about the P1 which points you to the thread on the pocket beagle that goes through this. I have finished with my schooling and doing some repairs on my vehicles. Once I am done with those I hope to get back to working on the M2 and will be looking at doing some things with the P1. Because the P1 should be easier to program I MAY try to add the protocols there first. I hope to create a new interface on the P1 that will be compatible with SocketCan but will go well beyond it.

Rodney

SWCAN on the P1 is fairly easy.

First - Ignore the advice at https://docs.macchina.cc/p1-docs/getting-started that tells you to skip the entire section and just use config-pin - lighting up SWCAN will be a PITA if you do this.

Instead, follow the instructions in the section (I don’t know why they tell you to skip it because it’s in flux, because it works perfectly), and in addition to the CAN0 and CAN1 dtbo files listed, also enable the following overlay:
PB-MCP2515-SPI1.dtbo

At this point, you should now have all three CAN interfaces available. To use SWCAN you also need to configure the PHY to a mode other than 0. I used Adafruit’s BBIO library to set P2_6 and P2_18 both as GPIO outputs and set them to HIGH. At that point, I can send/receive from the SWCAN bus. I can also send high voltage wakeups by setting the mode pins appropriately.

Unfortunately, it looks like I’m going to have to get an M2 UTH interface board and do some hardcore splicing to do what I want, because GM firewalled the particular messages I need to send.

Thank you for the answers. I tried the overlay enabling but candump and everything else simply do nothing. No traffic. CAN0 and CAN1 traffic work only with config-pin commands on every startup and default uEnv. Why? Or how do I enable SWCAN with config-pin?

Never mind, I made it work. I had a wrong image. Installed this newer one.
https://rcn-ee.com/rootfs/bb.org/testing/2019-12-02/stretch-iot/bone-debian-9.11-iot-armhf-2019-12-02-4gb.img.xz