Giter Club home page Giter Club logo

mcp2515's People

Contributors

adamvoss avatar andycook avatar collin80 avatar rechargecar avatar rowantaubitz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mcp2515's Issues

Extended frame flag is stored as an '8', causing strange behavior down the line

In MCP2515::ReadBuffer(), message.extended is set by a bit mask (byte2 & B00001000)

Because CAN_FRAME flags are uint8's, the value '8' is stored, and eventually printed into log files in M2RET, confusing savvyCAN which doesn't interpret the 8 as being true.

I'm sure there's a good reason for this, but why aren't the flags in CAN_FRAME defined as bool?
In any case, this can probably be fixed by casting the bit mask result to a bool before assigning it. We should probably do the same for RTR.

CANPIDTest sketch won't compile

Copy pasted the code exactly to play with and i get these errors. I know it's an old library, but has something changed?

sketch_oct28a:44:1: error: 'Frame' does not name a type
 Frame testMessage;
 ^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: In function 'void setup()':
sketch_oct28a:90:32: error: no matching function for call to 'MCP2515::SetRXMask(int, int, int)'
   CAN.SetRXMask(MASK0, 0x7F8, 0); //match all but bottom four bits
                                ^
In file included from C:\Projects\sketch_oct28a\sketch_oct28a.ino:26:0:
C:\Users\ec\Documents\Arduino\libraries\mcp2515-master\src/MCP2515.h:85:7: note: candidate: void MCP2515::SetRXMask(uint8_t, uint32_t)
  void SetRXMask(uint8_t mask, uint32_t MaskValue);
       ^
C:\Users\ec\Documents\Arduino\libraries\mcp2515-master\src/MCP2515.h:85:7: note:   candidate expects 2 arguments, 3 provided
sketch_oct28a:100:7: error: 'testMessage' was not declared in this scope
       testMessage.id = 0x07DF;
       ^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: At global scope:
sketch_oct28a:114:1: error: 'Frame' does not name a type
 Frame message;
 ^
C:\Projects\sketch_oct28a\sketch_oct28a.ino: In function 'void loop()':
sketch_oct28a:117:22: error: 'message' was not declared in this scope
   if (CAN.GetRXFrame(message)) {
                      ^
sketch_oct28a:31:20: error: 'LED_BUILTIN' was not declared in this scope
 #define LED_CAN_TX LED_BUILTIN
                    ^
C:\Projects\sketch_oct28a\sketch_oct28a.ino:144:32: note: in expansion of macro 'LED_CAN_TX'
                   digitalWrite(LED_CAN_TX, txLEDState);
                                ^
exit status 1
'Frame' does not name a type

Does this library have any applicabilty to the Macchina M2?

This is the only bit of code that I have come across that I know to be targeting the Macchina v1.1 and I know there was some discussion about moving this under the macchina GitHub organization. Asking to know whether it should be clarified this is for an older Macchina product.

Race condition in interrupt handler causing failures when sending frames

If MCP2515::intHandler() is called from an actual interrupt handler while another SPI transfer is in progress, it will try to initiate another SPI transfer, causing one or both transfers to fail.

There are two ways to work around this in client code:

  1. Surround every call to sendFrame(), Mode(), SetRXFilter(), etc. with noInterrupts()/interrupts()
  2. Do nothing except set a flag in the actual interrupt handler, then call MCP2515::intHandler later.

The first method works for me because I am not using any other SPI devices on the bus. If I were, then I would have to also disable interrupts for those operations. The second method works best if the flag can be polled frequently, otherwise received frames might get lost.

I'm not sure what the best solution would be for fixing the library, though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.