Definition of eflg in this statement? channel.readRegister(EFLG)

So it look like I have my CBT all set to go, and I can send and receive via CoolTerm. However, I seem to only be the error "B" (in hex) when I check the status of the BUS 1 while connected via the OBD2 port. When I look at the SerialCommand.h file, it looks like the "B" I get is from the line of code


Is there someplace I can look up the potential values of EFLG and what they mean?

Ok, I may have an answer, but would like some correction from someone with more knowledge to make sure this is right.

Looking at <a href="">CANBus.h</a>, it looks like the EFLG is error register value 2D of the MCP2515.

Based on <a href="">some documentation</a> (page 47), it looks like the value "B" or "0B" translated into the 8 bit values (00001011) means that these errors occurred:

bit 3
RXEP: Receive Error-Passive Flag bit

  • Set when REC is equal to or greater than 128
  • Reset when REC is less than 128
    bit 1
    RXWAR: Receive Error Warning Flag bit
  • Set when REC is equal to or greater than 96
  • Reset when REC is less than 96
    bit 0
    EWARN: Error Warning Flag bit
  • Set when TEC or REC is equal to or greater than 96 (TXWAR or RXWAR = 1)
  • Reset when both REC and TEC are less than 96

So, if the error code is "0" that means no errors at all.

Those error codes are still not quite understandable to me. Would it be possible to make the error code more understandable, and maybe look something more like this <a href="">[source]</a>:

  • if (eflg & MCP_EFLG_RX1OVR)
  •    printf("Receive Buffer 1 Overflow\r\n");
  • if (eflg & MCP_EFLG_RX0OVR)
  •    printf("Receive Buffer 0 Overflow\n\r");
  • if (eflg & MCP_EFLG_TXBO)
  •    printf("Bus-Off\n\r");
  • if (eflg & MCP_EFLG_TXEP)
  •    printf("Receive Error Passive\n\r");
  • if (eflg & MCP_EFLG_TXWAR)
  •    printf("Transmit Error Warning\n\r");
  • if (eflg & MCP_EFLG_RXWAR)
  •    printf("Receive Error Warning\r\n");
  • if (eflg & MCP_EFLG_EWARN )
  •    printf("Receive Error Warning\n\r");

I've spent all day most of today trying to get my CBT to start spewing data. I found that if your getting error B your baud rate is set incorrectly. I could be completely wrong here but I found that the only Bus with a baudrate set is Bus 2,

I connected my Can2 of the CBT to the Comfort Bus of my VW Amarok and set the CANBus2.baudconfig(100); the default is (125) and now I seem to be getting data.

Also a guess here but changing your baud rate in Coolterm does nothing for the speed in which the CBT connects to the car.

I had no luck getting any baud rate connection via the supplied OBD 2 cable

Yeah, there seems to be something wrong with receiving messages via the OBD2 cable. If what I have above is correct, then the code I added to the CANBusTriple_Mazda\SerialComman.h will be more descriptive than "8". The part that I added is probably valid for the non-mazda example as well, but I didn't look into it.

There are a few posts from Derek about auto baud detection getting implemented this week. I'm hoping that's sooner rather than later, and solves the OBD2 cable problem.

I think changing the baud in CoolTerm is only changing the baud rate between the laptop and the CBT, not between the car and the CBT (which appears to be the problem).

I wasn't sure that the obd cable was going to work with my Vw amarok, wasn't sure if the pins would line up. That's why I hardwired my CBT to the comfort bus.

When I wired up to can1 all I could get was a baud rate error but when I changed it to bus 2 and adjusted the software that's when I started to see data.

I assume your trying to use your CBT on a Mazda if your using the Mazda build, do you know what bus speed your Mazda is?

Yes, Mazdaspeed3.

From what I've seen, it should be 125 (LS) and 500 (HS). It could be that my problem with the OBD2 cable is that it only connects CAN1 (HS), which is set to 125 (LS) in the Setting.H file. I tried changing the values there, but it didn't work.

  • 6
  • 5263

Looks like your connection to CANBus Triple was lost, please wait while we try to reconnect.