Issues with PICAN-M NMEA Hat setup

I got a PICAN-M hat for a Pi 4 running BlueOS v1.3.1 for connecting NMEA 2k & 0183 sensors.
Following the setup manual, I’ve run into a couple issues:

  1. The PICAN-M requires can-utils to be installed on the Pi. Using sudo apt-get install can-utils gives an error
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  can-utils
0 upgraded, 1 newly installed, 0 to remove and 171 not upgraded.
Need to get 118 kB of archives.
After this operation, 492 kB of additional disk space will be used.
Get:1 http://raspbian.freemirror.org/raspbian bullseye/main armhf can-utils armhf 2020.11.0-1 [118 kB]
Err:1 http://raspbian.freemirror.org/raspbian bullseye/main armhf can-utils armhf 2020.11.0-1
  File has unexpected size (1154 != 118016). Mirror sync in progress? [IP: 199.59.243.227 80]
  Hashes of expected file:
   - SHA256:29976f1d9f355665534c1105934e938d3c5e574ab05ed060302d5d304abcc8c6
   - SHA1:1fe710a1783cc866d6d80409c99ebb32118d832d [weak]
   - MD5Sum:7329bebf82eed3d599595b617a132c26 [weak]
   - Filesize:118016 [weak]
E: Failed to fetch http://raspbian.freemirror.org/raspbian/pool/main/c/can-utils/can-utils_2020.11.0-1_armhf.deb  File has unexpected size (1154 != 118016). Mirror sync in progress? [IP: 199.59.243.227 80]
   Hashes of expected file:
    - SHA256:29976f1d9f355665534c1105934e938d3c5e574ab05ed060302d5d304abcc8c6
    - SHA1:1fe710a1783cc866d6d80409c99ebb32118d832d [weak]
    - MD5Sum:7329bebf82eed3d599595b617a132c26 [weak]
    - Filesize:118016 [weak]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
  1. After adding the required lines to the /boot/config.txt file, the can0 interface doesn’t appear in ifconfig. It seems likely that the BlueOS configurations would interfere with the changes, but I’m not familiar with the boot config.
    Lines added to the end of the boot config:
enable_uart=1
dtparam=i2c_arm=on
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25

I’m troubleshooting the can0 interface first.
Any help is appreciated!

Hi @Nubbish -
Did you run that install command after taking the red-pill at the terminal, to exit the docker container?

How did you connect the shield you’re using with the Pi4 with the Navigator present? Or are you not using a Navigator?

I’ve had success using USB to canbus modules with BlueOS before, I’ve not seen the PICAN-M before. I’d be interested in understanding what method it is using to communicate with the Pi…

Hi @tony-white
Yes, it was run in a PuTTy shell connected to the Raspbian OS. I’ve read that Raspbian has had previous issues with package mirrors, but worst case I can do a manual install.

I’m not using a Navigator board. The Pi is acting as a secondary computer to a standalone autopilot via USB.
The shield is connected as usual. I tested it with base Raspbian OS and it works great, but trying to use BlueOS causes the issue I described.

Based on the PICAN-M schematics, it uses a MCP2515 chip connected to the Pi’s SPI bus for NMEA 2k.
https://copperhilltech.com/content/pican-m_rev_B.pdf
Maybe a process of BlueOS is already reserving the SPI bus for the Navigator?

The /boot/config.txt file also seems to automatically populate certain options if they’re changed or missing. I tried commenting out the SPI config options that are standard with BlueOS, but they get added again on the next boot:

dtoverlay=spi0-led
dtoverlay=spi1-3cs

Not sure where to go from here.