Arduino Uno R3 + Can-bus shield V 1.2 from http://www.seeedstudio.com/


hi new arduino programing skills minimum.

im want make can bus sniffer use on old bmw e39 use baudrate 100. communicate between engine ecu, transmission ecu, , abs ecu.

the problem don't receive data. recv indicator led on, , message "can bus shield init ok!" no data.

i have search internet days can't find anything

im have tried example code can bus library https://github.com/seeed-studio/can_bus_shield

and have tried code example http://www.instructables.com/id/hack-your-vehicle-can-bus-with-arduino-and-seeed-c/

i have tried remove terminal resistor.

sorry if english bad, hope it's understandable.

best regards.

here code using:

#include <spi.h>
#include "mcp_can.h"

int32u canid = 0x000;
unsigned char len = 0;
unsigned char buf[8];
char str[20];

const int spi_cs_pin = 9;

mcp_can can(spi_cs_pin);

void setup()
{   
serial.begin(115200);
start_init:
if(can_ok == can.begin(can_100kbps))
    {
        serial.println("can bus shield init ok!");
    }
    else
    {
        serial.println("can bus shield init fail");
        serial.println("init can bus shield again");
        delay(100);
        goto start_init;
    }
}
void loop()
{
    if(can_msgavail == can.checkreceive())
    {
        can.readmsgbuf(&len, buf);
        canid = can.getcanid();
        serial.println("-----------------------------");
        serial.print(canid);serial.print(",");
        for(int = 0; i<len; i++)
  {
    serial.print(buf);serial.print(",");
  }
  serial.println();
   }
}


Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Arduino Uno R3 + Can-bus shield V 1.2 from http://www.seeedstudio.com/


arduino

Comments

Popular posts from this blog

Error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode - Raspberry Pi Forums

class MPU6050 has no member named begin

missing filename after '-o'