Skip to content

Instantly share code, notes, and snippets.

@pdp7
Created January 28, 2019 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdp7/ed7714c93559a793fdcad6fc83f9fa58 to your computer and use it in GitHub Desktop.
Save pdp7/ed7714c93559a793fdcad6fc83f9fa58 to your computer and use it in GitHub Desktop.
swcan test
[ 36.680573] mcp251x spi2.1 can2: MCP2515 successfully initialized.
sudo ip link set can2 type can bitrate 500000 listen-only on
sudo ifconfig can2 up
sudo ifconfig can2
can2: flags=193<UP,RUNNING,NOARP> mtu 16
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 10 (UNSPEC)
RX packets 78947 bytes 591082 (577.2 KiB)
RX errors 157 dropped 0 overruns 0 frame 157
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
candump -cae can2,0:0,#FFFFFFFF
[ 36.680573] mcp251x spi2.1 can2: MCP2515 successfully initialized.
[ 373.857185] can: raw protocol (rev 20170425)
debian@beaglebone:~$ candump -cae can2,0:0,#FFFFFFFF|head -20
can2 1DC43772 [8] remote request
can2 1D5 [8] remote request
can2 1DC43772 [8] remote request
can2 1D5 [8] remote request
can2 1DC43772 [8] remote request
can2 1D5 [8] remote request
can2 1DC43772 [8] remote request
can2 1D5 [8] remote request
can2 1DC43772 [8] remote request
can2 5EF [8] 4A B3 F7 B3 CF CF BB B3 'J.......'
can2 1D5 [8] remote request
can2 5EF [8] 4A B3 F7 B3 CF CF BB B3 'J.......'
can2 1D5 [8] remote request
can2 5EF [8] 4A B3 F7 B3 CF CF BB B3 'J.......'
can2 1D5 [8] remote request
can2 1DC43772 [8] remote request
can2 5EF [8] 4A B3 F7 B3 CF CF BB B3 'J.......'
can2 1DC43772 [8] remote request
can2 5EF [8] 4A B3 F7 B3 CF CF BB B3 'J.......'
can2 1DC43772 [8] remote request
P2.06 #M0
P2.18 #M1
debian@beaglebone:/opt/source/bb.org-overlays$ config-pin -q p2.06
P2_06 pinmux file not found!
Cannot read pinmux file: /sys/devices/platform/ocp/ocp*P2_06_pinmux/state
debian@beaglebone:/opt/source/bb.org-overlays$ config-pin -q p2.18
P2_18 pinmux file not found!
Cannot read pinmux file: /sys/devices/platform/ocp/ocp*P2_18_pinmux/state
debian@beaglebone:/opt/source/bb.org-overlays$
###############################
DEVICE TREE OVERLAY CHANGED TO:
###############################
fragment@0 {
target = <&ocp>;
__overlay__ {
P2_25_pinmux { status = "disabled"; }; /* SPI1 MOSI - gpio1_9 */
P2_27_pinmux { status = "disabled"; }; /* SPI1 MISO - gpio1_8 */
P2_29_pinmux { status = "disabled"; }; /* SPI1 CLK - gpio0_7 */
P2_30_pinmux { status = "disabled"; }; /* SPI1 CS0 - gpio3_17 */
P2_31_pinmux { status = "disabled"; }; /* SPI1 CS1 - gpio0_19 */
P2_08_pinmux { status = "disabled"; }; /* SWC nINT */
P2_32_pinmux { status = "disabled"; }; /* SWC nRESET */
/* control from config-pin for SWCAN test */
/* P2_06_pinmux { status = "disabled"; }; */ /* SWC M0 */
/* P2_18_pinmux { status = "disabled"; }; */ /* SWC M1 */
};
};
fragment@1 {
target = <&spi1>;
__overlay__ {
status = "okay";
pinctrl-names = "default";
/* pinmux definitions used by pinctrl for these pins:
https://github.com/beagleboard/linux/blob/4.14/arch/arm/boot/dts/am335x-pocketbeagle.dts#L692
*/
pinctrl-0 = <
/* control from config-pin: &P2_06_gpio_pin */ /* SWC M0 */
/* control from config-pin: &P2_18_gpio_pin */ /* SWC M1 */
&P2_32_gpio_pu_pin /* SWC nRESET: enable pullup */
&P2_08_default_pin /* SWC nINT: use mode 0x37 */
&P2_25_spi_pin /* SPI1 MOSI: uart0_rtsn.spi1_d1*/
&P2_27_spi_pin /* SPI1 MISO: uart0_ctsn.spi1_d0 */
&P2_29_spi_sclk_pin /* SPI1 CLK: eCAP0_in_PWM0_out.spi1_sclk */
&P2_30_spi_cs_pin /* SPI1 CS0: mcasp0_ahclkr.spi1_cs0 */
&P2_31_spi_cs_pin /* SPI1 CS1: xdma_event_intr0.spi1_cs1 */
>;
################################
debian@beaglebone:~$ config-pin -q p2.18
P2_18 Mode: default Direction: in Value: 0
debian@beaglebone:~$ config-pin -q p2.06
P2_06 Mode: default Direction: in Value: 0
debian@beaglebone:~$ config-pin -l p2.06
default gpio gpio_pu gpio_pd gpio_input
debian@beaglebone:~$ config-pin p2.06 gpio_pu
debian@beaglebone:~$ config-pin p2.18 gpio_pu
@pdp7
Copy link
Author

pdp7 commented Jan 28, 2019

I thought I would reply here about SWCAN testing that I'm doing on the PocketBeagle.

I have the PocketBeagle with Macchina M2 adapter connected to an M2 processor board using the Macchina ODB-2 cable (which has 12V power attached).

The M2 processor board is running a SWCAN test that Josh created which is sending SWCAN messages,

I have set pins M0 and M1 high to test the PocketBeagle receiving the SWCAN messages. I believe this is correct based on this Arduino library code:
https://github.com/macchina/Single-Wire-CAN-mcp2515/blob/master/src/MCP2515_sw_can.cpp#L65

I'm receiving CAN messages but I'm not sure if they are correct or not:

debian@beaglebone:$ config-pin p2.06 gpio_pu #pull up SWC M0 to 3.3V for normal mode
debian@beaglebone:
$ config-pin p2.18 gpio_pu #pull up SWC M1 to 3.3V for normal mode
debian@beaglebone:$ sudo ifconfig can2 down
debian@beaglebone:
$ sudo ifconfig can2 up
debian@beaglebone:~$ candump -cae can2,0:0,#FFFFFFFF
can2 1D5 [8] remote request
can2 1FFEBFFB [8] remote request
can2 1D5 [8] remote request
can2 1FFEBFFB [8] remote request
can2 1FFEBFFB [8] remote request
can2 1D5 [8] remote request
can2 1FFEBFFB [8] remote request
can2 1D5 [8] remote request
can2 1FFEBFFB [8] remote request
can2 1FFEBFFB [8] remote request
can2 1D5 [8] remote request

The dump has repeating lines like the above until I kill it.

Any suggestions on how to determine if these are valid messages or not?

Thanks,
Drew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment