CAN bus Shield 1.2 + Seeed Stalker 2.3 + multiple SoftSerial

Hi everyone,

i’m trying to connection Seeeduino Stalker 1.2 + Seeed CAN Bus Shield v1.2 + GPS + and a custom board for Air quality.

The CAN bus Shield use SPI communication with pins 2 (INT), 9 (SS), the other pins of MCP2515 are connected to ICSP (MISO, MOSI, SCK)
The Air Quality board communicate with Stalker by a SoftSerial on pins 2 (TX) and 3 (RX).

My PCAN Exlorer Software sends messages to CAN Bus Shield with BitRate = 250 kbit/s, messages ID extended and Cycle Time from 20ms to 1000ms.
Specifically, only 3 messages have a Cycle Time of 20 ms, the other of 300ms, 500ms and 1000ms.

When I use only Stalker and one Shield all works, when I trying to use CAN bus shield with Air Quality nothing work.

Because of shared pin 2, I wanted to pause the CAN bus shield, acquired Air quality data every 5s and then acquire again CAN messages.

I tried:

  1. to disable interrupts, read Air quality data, and enable it.
  2. to disable SPI communication, read Air quality, and enable it.
  3. to use delay

but everything is not succesfull. Can anyone tell me what’s wrong? The code is in the attached file.

Here what I read in the serial monitor with CAN network active, lack environmental data:

CAN BUS Shield init ok!
Time: 79 - ID: 18FF8F03
Time: 147 - ID: 18FF8F03
Time: 217 - ID: 18FF8F03
Time: 284 - ID: 18FF8F03
Time: 354 - ID: 18FF8F03
Time: 421 - ID: 18FF8F03
Time: 489 - ID: 18FF8F03
Time: 559 - ID: 18FF1027
Time: 626 - ID: 18FF8F03
Time: 696 - ID: 18FF8F03
Time: 763 - ID: 18FF8F03
Time: 833 - ID: 18FF8F03
Time: 901 - ID: 18FF9F1E
Time: 970 - ID: 18FF8F03
Time: 1038 - ID: 18FF8F03
Time: 1107 - ID: 18FF9F1E
Time: 1175 - ID: 18FF8F03
Time: 1245 - ID: 18FF8F03
Time: 1312 - ID: 18FF9F1E
Time: 1382 - ID: 18FF8F03
Time: 1449 - ID: 18FF8F03
Time: 1519 - ID: 18FF8F03
Time: 1587 - ID: 18FF8F03
Time: 1656 - ID: 18FF8F03
Time: 1724 - ID: 18FF8F03
Time: 1794 - ID: 18FF8F03
Time: 1861 - ID: 18FF8F03
Time: 1931 - ID: 18FF8F03
Time: 1998 - ID: 18FF8F03
Time: 2068 - ID: 18FF8F03
Time: 2136 - ID: 18FF8F03
Time: 2205 - ID: CFF3F27
Time: 2273 - ID: 18FF8F03
Time: 2342 - ID: 18FF8F03
Time: 2410 - ID: 18FF9F1E
Time: 2480 - ID: 18FF8F03
Time: 2547 - ID: 18FF1027
Time: 2617 - ID: 18FF8F03
Time: 2684 - ID: 18FF8F03
Time: 2754 - ID: 18FF8F03
Time: 2822 - ID: 18FF8F03
Time: 2891 - ID: 18FF8F03
Time: 2961 - ID: 18FF8F03
Time: 3028 - ID: 18FF8F03
Time: 3098 - ID: 18FF8F03
Time: 3166 - ID: 18FF8F03
Time: 3235 - ID: 18FF8F03
Time: 3303 - ID: 18F0010B
Time: 3373 - ID: 18FF8F03
Time: 3440 - ID: 18FF8F03
Time: 3510 - ID: 18FF9F1E
Time: 3577 - ID: 18FF8F03
Time: 3647 - ID: 18FF8F03
Time: 3715 - ID: 18FF8F03
Time: 3784 - ID: 18FF8F03
Time: 3852 - ID: 18FF8F03
Time: 3921 - ID: 18FF8F03
Time: 3989 - ID: 18FF8F03
Time: 4059 - ID: 18FF1027
Time: 4126 - ID: 18FF8F03
Time: 4196 - ID: 18FF8F03
Time: 4263 - ID: 18FF8F03
Time: 4333 - ID: 18FF8F03
Time: 4401 - ID: 18FF9F1E
Time: 4470 - ID: 18FF8F03
Time: 4538 - ID: 18FF8F03
Time: 4608 - ID: CFF3F27
Time: 4675 - ID: 18FF8F03
Time: 4745 - ID: 18FF8F03
Time: 4812 - ID: 18FF9F1E
Time: 4882 - ID: 18FF8F03
Time: 4950 - ID: 18FF8F03
Time: 5019 - ID: 18FF8F03
Time: 5087 - ID: 18FF8F03
Time: 5156 - ID: 18FF8F03
Time: 5224 - ID: 18FF8F03
Time: 5294 - ID: 18FF8F03
Time: 5361 - ID: 18FF8F03
Time: 5431 - ID: 18FF8F03

Here the code without CAN network:

CAN BUS Shield init ok!

Time: 0 - Ambiental data: 0740, 0242, 0455, 000017068, 0016, 0267, 0000, 0196, 0000005, 0740, 0242,000
CAN Message EVCU1_DICO: 000000000

Time: 5000 - Ambiental data: 0740, 0242, 0455, 000017392, 0016, 0265, 0000, 0195, 0000004, 0740, 0242, 0455, 10007
CAN Message EVCU1_DICO: 000000000

Time: 10000 - Ambiental data: 0739, 0242, 0454, 000019903, 0016, 0265, 0000, 0198, 0000006, 0739, 0242, 04662 0

CAN Message EVCU1_DICO: 000000000

Time: 15000 - Ambiental data: 0737, 0242, 0454, 000017946, 0016, 0265, 0000, 0196, 0000004, 0737, 0242, 0401000
CAN Message EVCU1_DICO: 000000000
CAN_e_Ambiente.zip (2.05 KB)