107-Arduino-Cyphal icon indicating copy to clipboard operation
107-Arduino-Cyphal copied to clipboard

Unable To Run Service Example On Raspberry Pi Pico

Open AS12Dev opened this issue 1 year ago • 3 comments

Unable To Run Service Example On Raspberry Pi Pico

Hi, I am able to build and run the heartbeat examples successfully, and have produced nodes that send and receive multiple types of messages. However, although I am able to compile the service examples, nothing is displayed on the serial monitor. I haven't altered the code aside from setting the SPI pins. Thanks in advance for your help.

Code:

// ------------- SPI Communication Pins -------------

constexpr unsigned int SPI_INT                  =  6;
constexpr unsigned int SPI_TX                   = 19;
constexpr unsigned int SPI_SCK                  = 18;
constexpr unsigned int SPI_CS                   = 17;
constexpr unsigned int SPI_RX                   = 16;

// --------------------------------------------------

...

SPI.setRX(SPI_RX);
SPI.setTX(SPI_TX);
SPI.setSCK(SPI_SCK);
SPI.setCS(SPI_CS);
SPI.begin();
pinMode(SPI_CS, OUTPUT);
digitalWrite(SPI_CS, HIGH)

...

pinMode(SPI_INT, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(SPI_INT), []() { mcp2515.onExternalEventHandler(); }, FALLING);

Configuration Data Used:

  • Build Toolchain: Arduino IDE 1.8.19
  • Arduino Core: earlephilhower / arduino-pico
  • Library Version: Latest release of 107-Arduino-Cyphal & 107-Arduino-MCP2515

EDIT

By removing and re-inserting the jumper for the CAN Bus resistor on the MCP2515 breakout board manually, I am able to get the service request to send and then print the response once as expected. Hopefully this helps with diagnosing the issue, I'm assuming this maybe indicates an issue with the interrupt?

AS12Dev avatar Jul 31 '22 16:07 AS12Dev

Hi @AS12Dev ☕ :wave:

Thank you for your report. Honestly, this sounds very much like a physical layer problem to me. Can you narrow it down by writing a very simplified sketch just sending one singular CAN frame from one board to the next?

aentinger avatar Aug 01 '22 13:08 aentinger

Thank you for getting back to me so quickly. Sending one singular CAN frame from one pico to the other works as expected.

ghost avatar Aug 01 '22 19:08 ghost

Another thought: The OpenCyphal-Service-Client fires off the request only once (and immediately after startup). Could it be that the server is not up be the time the client sends the request?

aentinger avatar Aug 02 '22 07:08 aentinger