Seeeduino LoraWan /w gps SPI Can-Bus Shield v2.0

Arduino, Seeeduino Serials and mutants. Share your problems and experence on arduino compatible board such as seeeduino/stalker, etc.

Moderators:, violet, salmanfarisvp

Post Reply
Posts: 1
Joined: Sun Dec 09, 2018 8:11 pm

Seeeduino LoraWan /w gps SPI Can-Bus Shield v2.0

Post by ezra » Sun Dec 09, 2018 8:25 pm

We are trying to connect the Seeed Can-bus shield v2.0 to our seeeduino lorawan. We can get it working on an arduino UNO without any problems, but not on the seeeduino.
We have regulated the SPI voltages from the can bus shield down tot 3.3 volt (confirmed with multimeter) and we have tried changing the spi clock (because the seeduino runs at 48Mhz) but we did not have any luck.
We have tried different CS-SS pins, we have tried the ICSP pins as well as the SPI pins located on D10-13.
As we understand the lora module uses pin D10 so we used pin D9 but that does not work either.

this is our current code. with the arduino it immediately said "Can bus shield init OK" but with the seeduino not.

Code: Select all

// demo: CAN-BUS Shield, receive data with check mode
// send data coming to fast, such as less than 10ms, you can use this way
// loovee, 2014-6-13

#include <SPI.h>
#include "mcp_can.h"
//#include <LoRaWan.h>

// the cs pin of the version after v1.1 is default to D9
// v0.9b and v1.0 is default D10
const int SPI_CS_PIN = 9;
unsigned char len = 0;
unsigned char buf[8];
unsigned char flagRecv = 0;

MCP_CAN CAN(SPI_CS_PIN);                                    // Set CS pin

void setup()
  Serial.println("CAN BUS Shield init fail");
  while (CAN_OK != CAN.begin(CAN_500KBPS))              // init can bus : baudrate = 500k
    Serial.println("CAN BUS Shield init fail");
    Serial.println(" Init CAN BUS Shield again");
  Serial.println("CAN BUS Shield init ok!");

  attachInterrupt(0, MCP2515_ISR, FALLING); // start interrupt

  CAN.init_Mask(0, 0, 0x7ff);
  CAN.init_Mask(1, 0, 0x7ff);
  CAN.init_Filt(0, 0, 0x240);

void MCP2515_ISR()
  flagRecv = 1;

void loop()
  if (flagRecv)
    flagRecv = 0;
    CAN.readMsgBuf(&len, buf);    // read data,  len: data length, buf: data buf

    unsigned long canId = CAN.getCanId();
    Serial.print("<"); Serial.print(canId); Serial.print(",");
    for (int i = 0; i < len; i++)
    Serial.print(buf[i]); Serial.print(",");

Does anyone have any other ideas to try, or know what we are missing?

Thanks in advance!

Posts: 20
Joined: Fri Sep 28, 2018 3:35 pm

Re: Seeeduino LoraWan /w gps SPI Can-Bus Shield v2.0

Post by xianning.lan » Sat Dec 29, 2018 11:45 am

Hi there,
The problem you said may be caused by Serial. In Seeeduino LoRaWan, we use SerialUSB instead of Serial, so we recommend that you copy the library files to the project directory, and replace Serial with SerialUSB in mcp_can.cpp and your .ino file.
And you can see CAN Bus data in Serial Monitor.
Best Regards,

Post Reply