acan2515 icon indicating copy to clipboard operation
acan2515 copied to clipboard

feature-request: sleepmode and changing filters

Open thezenox opened this issue 6 years ago • 3 comments

nice lib, but I am missing sleep mode and changing filters on the fly. Do you plan to add it?

Bits 5-7 of CANCTRL_REGISTER 000 = Set Normal Operation mode 001 = Set Sleep mode 010 = Set Loopback mode 011 = Set Listen-only mode 100 = Set Configuration mode

Would be nice with bit modifing and readback. Before setting filters, enter configuration mode and change back to normal mode afterwards.

thezenox avatar Feb 07 '19 11:02 thezenox

HI thezenox To change filters, just change the filters[x].mMask, rxm0, rxm1, and recall "begin", this is what I did. rxm0 = standard2515Mask(***); rxm1 = standard2515Mask(***); filters[x].mMask = standard2515Filter (***); ... errorCode = PRI.begin (settings, [] { PRI.isr (); }, rxm0, rxm1, filters, 6);

qwec01 avatar Feb 11 '19 09:02 qwec01

Sorry for the delay for answering.

Changing the filters on the fly can be done only if the MCP2515 is in the configuration mode. It is not documented, but you can call can.begin several times, this function first puts the MCP2515 in the configuration mode, sets the filter, then puts the MCP2515 in normal mode. This is a way for changing filters on the fly.

I can add the following functions: - a can.end that puts the MCP2515 in configuration mode, and frees the driver transmit and receive buffers; - a can.setMode that puts the MCP2515 in Sleep mode, or Listen-only mode, or Normal Operation mode; - a can.setFilters function first gets the current mode, puts the MCP2515 in the configuration mode, sets the filter, then restores the MCP2515 current mode.

Do you agree ?

Pierre

Le 7 févr. 2019 à 12:52, Flo [email protected] a écrit :

nice lib, but I am missing sleep mode and changing filters on the fly. Do you plan to add it?

Bits 5-7 of CANCTRL_REGISTER 000 = Set Normal Operation mode 001 = Set Sleep mode 010 = Set Loopback mode 011 = Set Listen-only mode 100 = Set Configuration mode

Would be nice with bit modifing and readback. Before setting filters, enter configuration mode and change back to normal mode afterwards.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pierremolinaro/acan2515/issues/6, or mute the thread https://github.com/notifications/unsubscribe-auth/ASys1MmL67Xth63vVD7v1y53zmgLMJjxks5vLBODgaJpZM4anImk.

pierremolinaro avatar Feb 11 '19 20:02 pierremolinaro

I would love to have those functions. @thezenox ?

ravelab avatar Aug 10 '19 19:08 ravelab