View previous topic :: View next topic |
Author |
Message |
simonrash
Joined: 24 Sep 2009 Posts: 3
|
Wake from sleep on CAN activity |
Posted: Thu Sep 24, 2009 7:13 am |
|
|
I wish send a 18F258 to sleep and get it to wake on any CAN activity sleep is fine but it will not wake. I see that there is an interrupt available to do this but it's not working. Am I missing a reg change other than the int setting as testing on the external interrupt works. thanks for any advice. |
|
|
Ttelmah Guest
|
|
Posted: Thu Sep 24, 2009 9:18 am |
|
|
Read the data sheet.
Look at the section on sleep.
Look at the paragraph 'wake up from sleep'. What does it say after the list of what devices _can_ wake you from sleep?.
Best Wishes |
|
|
simonrash
Joined: 24 Sep 2009 Posts: 3
|
|
Posted: Thu Sep 24, 2009 9:58 am |
|
|
Thanks for the pointer. I got stuck on the data sheet section reading about the CAN module interrupts that says this will wake the device from sleep but as it does not look to be working I guess that's incorrect information. any other pointer if this is not the case would be great. Thanks |
|
|
Ttelmah Guest
|
|
Posted: Thu Sep 24, 2009 3:07 pm |
|
|
OK.
The key is understanding sleep.
The simpler processors have a single 'sleep' mode. The more complex ones, have 'low power' modes available, which don't put everything to sleep. CAN itself only works, provided you maintain a clock to the CAN module.
What you can do, is if your bus is _idle_, you can switch the CAN module to disabled mode, enable INT_CANWAKE, disable all other interrupts, and INT_GLOBAL, then put the chip to sleep. It will wake up on CAN bus activity (but not receive anything). You then have to enable the CAN module again, and can start to listen to the bus.
Obviously the other device(s) on the bus, need to know that they can't send actual data, till a significant time after waking the chip (typically about a 1000 clock cycles is required for the oscillator to start up, and you then have to allow time for the module to be reprogrammed as well.
This may do what you want?.
Best Wishes |
|
|
|