-
Notifications
You must be signed in to change notification settings - Fork 280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for One-Shot Mode (OSM) #65
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 176 needs to be ==
I guess not. No change is necessary. |
I get compiler errors the way it is: C:\Users\andre\Documents\Arduino\libraries\arduino-mcp2515\mcp2515.cpp: In member function 'MCP2515::ERROR MCP2515::setMode(MCP2515::CANCTRL_REQOP_MODE)': and since its basically the same as I´d say it needs to be a comparison, not an assignment. It still send 2 messages as a burst tho, not 1... |
Haha thanks for showing me indirectly a mistake here. The solution is to remove const keyword. SIMPLE. Or use a entirely new variable. I,ll make the changes tom its late here. Plz consult how shorthand if are used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had a go at implementing this update. it compiles just fine, but does not place the MCP2515 into one shot mode.
the code i am using will command the mcp2515 to transmit a can message when user inputs "1" in serial monitor.
with OSM disabled, this should cause the message to be retransmitted until an acknowledge bit is received. with OSM enabled, this should cause the message to be only transmitted once.
i have attached oscilloscope to CANL and have screen shots of both scenarios attached.
if enableOSM works properly, it should only transmit one message. unfortunatley, it is identical to disableOSM behavior.
Here is the doc of MCP2515: http://ww1.microchip.com/downloads/en/DeviceDoc/80179g.pdf I think #30 solved the problem temporarily, we can direct operate SPI. |
This don't work: This work: |
Very good catch. The Here is a picture from the mcp2515 datashet; I can also confirm this fixes it, tested with an osciloscope. @Loverboy7000 This would be a great feature to have in the master, is there anything I could do to help? |
anyone can merge this? |
Just added the support for One-Shot Mode.
Simple usage is to call the
"enableOSM"
or"disableOSM"
member function before configuring the mode of operation.Let me know if any optimization is needed or could be done in a better way.