Snooze - Finding all the Gotchas

Status
Not open for further replies.

LogicLow

Member
Duff2013's Snooze library is absolutely brilliant, although it does seem to have a few 'gotchas' which aren't made apparently.

1)If your using the USB Serial for Debugging, you will need to perform another Serial.Begin after going to sleep and waking up.
2)If using CAN, you will need to completely re-initialize the whole CAN system so its all hunky dorey. Eg. CANBus = FlexCAN(500000).

Theres probably more. Essentially anything that you setup initially needs to be redone. Hopefully that saves someone from some frustration!
 
1)If your using the USB Serial for Debugging, you will need to perform another Serial.Begin after going to sleep and waking up.
2)If using CAN, you will need to completely re-initialize the whole CAN system so its all hunky dorey. Eg. CANBus = FlexCAN(500000).

Theres probably more. Essentially anything that you setup initially needs to be redone. Hopefully that saves someone from some frustration!


  1. There is now a USB Serial driver class that attempts to handle usb serial issues with sleeping, here, here and here are examples of using it.
  2. I'll take a look at this maybe I'll write driver class.
 
The Snooze library is the greatest thing since sliced bread. My question is what is the purpose of the new lc5vBuffer block?

I'm not using it and I'm having an issue in low power on the LC, so I wanted to understand it (the LC is so different from the 3.x).
 
SnoozeUSBSerial.cpp doesn't build with USB serial disabled ("RawHID" or "No USB" config).

Code:
.../hardware/teensy/avr/libraries/Snooze/utility/SnoozeUSBSerial.cpp: In member function 'virtual void SnoozeUSBSerial::disableDriver()':

.../hardware/teensy/avr/libraries/Snooze/utility/SnoozeUSBSerial.cpp:19:5: error: 'usb_cdc_line_rtsdtr' was not declared in this scope

     usb_cdc_line_rtsdtr = 0;

     ^
.../hardware/teensy/avr/libraries/Snooze/utility/SnoozeUSBSerial.cpp:20:5: error: 'usb_cdc_line_rtsdtr_millis' was not declared in this scope

     usb_cdc_line_rtsdtr_millis = systick_millis_count;

     ^
 
As long as you are in the fixing mode, here's a few more:

1. Teensy at 24 MHz doesn't return to correct clock speed upon waking. clocks.h line 311 - 4's should be 3's (see mk20dx128.c line 1012).
2. sleep_usb_serial.ino example file won't compile - typo on line 1.
3. usb_serial examples line 68 - should it be || (or) or && (and)? I got stuck forever when usb didn't come up - is that what you meant?
4. HardwareSerial example doesn't need delay_lp anymore now that delay works.
5. Copy and paste error in comment - Snoozelc5vBuffer.cpp line 21 says usb clock.
 
As long as you are in the fixing mode, here's a few more:

1. Teensy at 24 MHz doesn't return to correct clock speed upon waking. clocks.h line 311 - 4's should be 3's (see mk20dx128.c line 1012).
2. sleep_usb_serial.ino example file won't compile - typo on line 1.
3. usb_serial examples line 68 - should it be || (or) or && (and)? I got stuck forever when usb didn't come up - is that what you meant?
4. HardwareSerial example doesn't need delay_lp anymore now that delay works.
5. Copy and paste error in comment - Snoozelc5vBuffer.cpp line 21 says usb clock.
I fixed these and updated github, thanks for pointing them out. Number 3 should be || since the timer is for not getting stuck in that while loop.
 
Thanks for fixing these. Regarding item 3:

Code:
 while (!Serial || time < 1000) {

If the intent is to exit after 1 second, even if Serial is not up yet, it doesn't do that. Using De Morgan's law, it exits when Serial AND time >= 1000.

Also, I'm working on getting the reduced_cpu_block HardwareSerial example to work for LC. Once again, LC is different than everybody else (baud rate calculation). I'll send it via github when it's ready (don't hold your breath though).
 
Status
Not open for further replies.
Back
Top