waspmote failing to read CANbus messages corretly

Questions about the Waspmote v15 and its modules
Post Reply
s1buell
Posts: 54
Joined: Thu Jul 23, 2015 6:16 pm

waspmote failing to read CANbus messages corretly

Post by s1buell » Thu Dec 12, 2019 4:35 pm

Hi,

I am having issues with the data read from a sensor. The sensor is communicating to waspmote via CANbus and libelium CAN module. The data sent by the sensor isn`t always correctly printed by waspmote. While searching for the source the errors i found out the message sent by the sensor arrives with extreme noise in the waspmote. I also tried to receive and print the messages from the sensor with an arduino and a libelium CAN module and it worked just fine.

These are some examples of how the incoming data waveform looks like: https://1drv.ms/u/s!AshSdehJ-ml8m3aMx9P ... G?e=8cuXYU

This is how it looks like in the CAN module and MCP2551`s Can H and Can L pins: https://1drv.ms/u/s!AshSdehJ-ml8nAEvzig ... K?e=etth4I

Blue wave is Can High, Red is Can Low and Purple is Can High - Can Low

The code i`m using:

Code: Select all

#include <WaspCAN.h>

    float data;
    float data1;
    float data2;
    float data3;
    float data4;
    float data5;
    float data6;
    float data7;
    float datavector[8];
    int A;
    int dataint;
    int errorCount = 0;

// Setting up our devices and I/Os 
void setup() {
  
  // Inits the USB
  USB.ON();
  delay(100);

  USB.println("Initializing CAN Bus...");
  CAN.ON(250);
  USB.println("Initialized CAN BUS at 250kB/s");
  delay(100);
}

void loop() {

    if(errorCount >= 5)
      {
        PWR.reboot();
        USB.println("reboot");
        //errorCount = 0;
      }
      
  if (CAN.messageAvailable() == 1)
  {
    // Read the last message received
    CAN.getMessage(&CAN.messageRx);
    //CAN.CiARequest(0x67F);
    //USB.println("request sent");
    // Print in the USB monitor the received message
    
  if(CAN.messageRx.id == 0x67F)//CAN.messageRx.id == 0x19FF0064)
    {
    CAN.printMessage(&CAN.messageRx);
    datavector[0] = uint16_t(CAN.messageRx.data[0]);
    datavector[1] = uint16_t(CAN.messageRx.data[1]);
    datavector[2] = uint16_t(CAN.messageRx.data[2]);
    datavector[3] = uint16_t(CAN.messageRx.data[3]);
    datavector[4] = uint16_t(CAN.messageRx.data[4]);
    datavector[5] = uint16_t(CAN.messageRx.data[5]);
    datavector[6] = uint16_t(CAN.messageRx.data[6]);
    datavector[7] = uint16_t(CAN.messageRx.data[7]);

    for(A = 0;A < 8;A++)
    {
      dataint = datavector[A];
      USB.print(dataint);
      USB.print(" | ");
      if(A == 3 || A == 7)
      {
        USB.print("\n");
      }
    }
  }
  else
  {
    USB.println("different id");
    errorCount++;
  }
  }
  else
  {
    USB.println("No message avaliable");
    errorCount++;
  }

    delay(1000);
}
While using waspmote, very frequently, the data printed is incorrect or it doesn`t even communicate. Also, i tested again with different waspmotes (v1.5 and v1.2) and modules but the results were the same.

Any help is welcome, thanks for your attention.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: waspmote failing to read CANbus messages corretly

Post by libelium-dev » Mon Dec 16, 2019 10:53 am

Hi,

Could you please share and image of the bottom part of the CAN bus module? What is the order number of the module? We sold two versions of CAN bus module depending if they are going to be use with Arduino or Wapmote. It seems that you have an Arduino CAN bus module and therefore the module doesn't include the Voltage-level Translator component needed to communicate with Waspmote.

Regards

s1buell
Posts: 54
Joined: Thu Jul 23, 2015 6:16 pm

Re: waspmote failing to read CANbus messages corretly

Post by s1buell » Mon Dec 16, 2019 2:23 pm

Images: https://1drv.ms/u/s!AshSdehJ-ml8nAzW7aQnt7ZAOwi2
I couldn't find the order number, the modules were ordered 2 or 3 years ago.

libelium-dev
Posts: 27967
Joined: Mon Sep 28, 2009 1:06 pm

Re: waspmote failing to read CANbus messages corretly

Post by libelium-dev » Wed Dec 18, 2019 9:40 am

Hi,

They are CAN bus modules for Arduino and therefore they don't work with Waspmtoe properly.

Regards

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest