How long are you waiting? If the WDT poscaler in config is set to 32,768 it's going to take around 131 seconds before it wakes-up.
How long are you waiting? If the WDT poscaler in config is set to 32,768 it's going to take around 131 seconds before it wakes-up.
the WDTPS is 128 as in #9, and actually it takes several seconds before that sleep instrucion is reached in the demo code (#9) as well as in the "big" code where I spotted this phenomena/error/failure at first.
I have never seen sleep working, yet...
but I would really like to see it![]()
How are you setting the WDT postscaler to 128?
The watchdog timer postscaler & on/off options are configuration options. These are set at
program time.
PBP allows you to DEFINE pretty much anything without throwing an error, but that doesn't
mean your defines are doing anything.
If you're using the older version Microchip USB boot-loader firmware, these are set in the C
code.
You can open the loader .HEX file with your programmer, change WDTPS from 32768 to 128Code:#pragma config WDT = OFF #pragma config WDTPS = 32768
then save the .HEX file & re-program your 4550 with the modified loader firmware. Then you
will have a postscaler of 128. I would leave WDT=OFF, and use the software enable option
WDTCON.0=1.
You'll also want to use DEFINE OSC 48 so PBP will use the correct timing. Without defining
the osc speed PBP defaults to 4MHz.
Thank you Bruce!
So, this means that you can not override them later with your running program?
The date for the "USB Device - HID - HID Bootloader - C18 - PIC18F4450.hex" is 19.6.2008. I opened the zip-file maybe 1,5-2 month ago.If you're using the older version Microchip USB boot-loader firmware, these are set in the C code.
I don't grasp this. How can I see or found WDTPS in a .HEX file?You can open the loader .HEX file with your programmer, change WDTPS from 32768 to 128 then save the .HEX file & re-program your 4550 with the modified loader firmware. Then you will have a postscaler of 128. I would leave WDT=OFF, and use the software enable option WDTCON.0=1.Code:#pragma config WDT = OFF #pragma config WDTPS = 32768
My program has DEFINE OSC 48, so that can not be the reason for this sleep-error.You'll also want to use DEFINE OSC 48 so PBP will use the correct timing. Without defining the osc speed PBP defaults to 4MHz.
Some 18F parts allow you to change config settings at run-time, but I wouldn't advise trying this until you're a bit more familiar with how to set them & what they all do. If you're using a boot-loader, you'll need to know every setting the loader expects, or you may end up doing a lot of loader firmware re-programming. If you search here for modifying config settings on-the-fly you'll find a couple routines showing you how.So, this means that you can not override them later with your running program?
You probably have the latest version then.[The date for the "USB Device - HID - HID Bootloader - C18 - PIC18F4450.hex" is 19.6.2008. I opened the zip-file maybe 1,5-2 month ago.
Easy. Open the loader .HEX file with your programmers software. Change it, save the .HEX file, and re-program the loader into your PIC.I don't grasp this. How can I see or found WDTPS in a .HEX file?
OK. It wasn't shown in the example you posted. Note this won't have anything to do with the WDT or sleep error. Only timing for PBP commands.My program has DEFINE OSC 48, so that can not be the reason for this sleep-error.
If your programmers software doesn't allow you to read a .HEX file and make changes to config settings, then you can re-compile the loader firmware with the free version of C18.
Or I can send you a modified version .HEX file if you need it.
What USB board are you using?
Bookmarks