Skip to content
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

not entering sleep mode properly #36

Open
atc1441 opened this issue Mar 20, 2020 · 2 comments
Open

not entering sleep mode properly #36

atc1441 opened this issue Mar 20, 2020 · 2 comments

Comments

@atc1441
Copy link

atc1441 commented Mar 20, 2020

Hi, as the SleepMode is not entered most of the times with the current setMode void i suggest the following changes:

put the modifyRegister: https://github.com/autowp/arduino-mcp2515/blob/master/mcp2515.cpp#L167

inside the while loop so it will rewrite the register.

also set the timeout from 10ms to 200ms as the sleep mode entering can take up to 100ms

i also suggest to add the sleepWakeup bit (CANINTF_WAKIF) into the reset void: https://github.com/autowp/arduino-mcp2515/blob/master/mcp2515.cpp#L50

so it will wake up on can messages, or maybe make an extra function to enable or disable that bit so everyone can set if needed.

@jxltom
Copy link
Collaborator

jxltom commented Mar 24, 2020

Current code works for me for entering the sleep mode.

Do you mind enlighting me where the specification of that entering sleep mode can takes 100ms? I didn't find it in the datasheet.

@atc1441
Copy link
Author

atc1441 commented Mar 24, 2020

I tested the time it took to bring it to sleep mode with the edited function, and sometimes it was up to 100ms, it was not from the datasheet.

With the stock function i was not able get it into standby mode by calling it one time, even with disabled timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants