dsPIC30FXX Devices and Clock Postscaler

In some applications that make use of the clock postscaler, certain precautions need to be taken to ensure that communication with the debugger or emulator is maintained throughout a device interrogation and a programming operation.

With the dsPIC30F series of devices, such as the dsPIC30F60XX, dsPIC30F40XX, dsPIC30F30XX, and dsPIC30F20XX, that have the clock prescalers as an optional clock mode, the ICSP sequence can get out of synchronization and cause programming operations to fail. This happens because the instructions are clocked in a bit at a time and the prescaler also divides the serial data instruction stream.

What further complicates this issue is when applications also use FRC as the clock source and the target power is used. In these situations, the application code that sets up the oscillator postscaler in the OSCCON register begins executing immediately after power-up. Any subsequent MCLR or device Resets do not reset OSCCON, which causes attempts to communicate via the serial channel after this point invalid.

A workaround for this scenario in development is to run from an external crystal or oscillator source. The oscillator needs to be disabled and the target power cycled to clear the OSCCON register to program the device once more.

Additionally, a long delay can be inserted prior to the postscaler configuration setup so the debugger and programmer tool can identify the device and still leave enough time to invoke an erase operation to take place before OSCCON is modified by the application.

Alternatively, consider not using the postscaler during general code development and add the postscaler configuration only as the application development nears completion. For devices in this situation, the MPLAB PM 3 programmer can be used to dynamically switch power and may have enough current (<250 ma) to power up the target completely and keep the OSCCON register cleared.

© 2016 Microchip Technology, Inc.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.