Microchip dsPIC33
Device-specifics for the Microchip dsPIC33 microcontrollers.
Config words
The config words are used to configure the device and to protect the memory against unintentional readout. The various Microchip PIC devices differ significantly in the config words. Please consult the corresponding data sheet of the device for more information.
When the config words are present in the data file (HEX, SREC, BIN, ELF...) they are used after Programming/Verify is finished. An indication of which config words were used is displayed at the end of the programming process with the corresponding "VerbosityOutput".
Low-voltage programming
Low-voltage programming (LVP) refers to a programming mode that allows PIC devices to be programmed without an higher voltage when this mode is not disabled by config word settings. It is not possible to disable the LVP mode in LVP mode, which leads to an error when verifying the configuration words. Programming mode changing is only possible in HVP mode!
To contact boards with the Microchip RJ12 adapter, we offer the following adapter: SEGGER's Microchip LVP adapter
High-voltage programming
High-voltage programming (HVP) refers to a programming mode that allows PIC devices to be programmed in all cases.
Note: It is not possible to use the Microchip LVP adapter mentioned above, as the increased programming voltage of Pin 17 is routed to #MCLR pin 6 of the RJ12 connector
How to connect a device
After the device has been selected in U-Flash, you can display the connection assignment via "show wiring"
Please note that an external level shifter is required for the programming voltage! A pulldown resistor of approx. 1K is required on the Vpp line as the ProgVoltageAdapter has an open drain output!
The wiring on the target side must be taken from either the boards circuit diagram or the corresponding data sheet.
Memory scheme
Program memory
PIC16 devices have a 14bit wide instruction set. Each instruction is places in a word.
Each word has it's own address. Addresses are incremented by 1.
The HEX files generated by the Microchip IDE are byte oriented. Each word uses 2 bytes. Bit 14 and bit 15 are unused in that file so that each word consumes 2 bytes.
That is why the addresses in the datasheet and in the IDE differ by a factor of 2 from those in the HEX file and in the Flasher.
E.g.. The address 0x0FF6 in the HEX file is displayed as 0x07FB in the IDE.
EEPROM memory
The EEPROM memory width is 8 bit wide. However, each payload byte requires 2 data bytes. One byte is always zero. The address of the EEPROM data is predefined by the Microchip IDE. In this example the EEPROM maps to 0x4200. In the IDE, the EEPROM is displayed at address 0x00 and does not show the unused stuff bytes.
In the HEX file above the EEPROM data can be observed in line 3 at address 0x4200.
U-Flash memory map
U-Flash always works byte oriented. That is why the addresses are displayed exactly as they are specified in the HEX file. This may cause confusion for some PIC users, but it is intentional.
Limitations
Programming in HVP
By itself, Flasher cannot provide the voltage required to program in HVP mode. One of the following methods can be used to program a PIC device that is in HVP mode, using Flasher:
- Use SEGGER's programming voltage adapter and select HVP mode in U-Flash. A pulldown resistor of approx. 1K is required on the Vpp line as the ProgVoltageAdapter has an open drain output!
- Use Microchip's PICkit to set the device in LVP mode and change the respective config word in the data file to LVP mode
Lower supply voltages
Some PIC device are not able to perform a bulk erase when using lower voltages than the maximum/nominal supply voltage. When using lower supply voltages, "sector erase" and lower ICSP frequencies must be used. Please refer to the corresponding datasheet of your specific device.
Troubleshooting
Device ID does not match
At the start of programming, the Flasher tries to connect to the device and to read out the device ID. Each PIC device has a unique ID.
If an error is output regarding the device ID, this can have several root causes.
To obtain detailed information on the error, increase the "VerboseOutput" in the U-Flash configuration to at least "INFO" and transfer the project to the Flasher again.
Device ID = 0000 or 3FFF
- There is a fault in the wiring
- The device is kept in reset by an external reset generator or watchdog
- The supply voltage is insufficient
- The device is set to HVP mode while you are trying to work in LVP mode
Device ID is wrong
- The wrong device was selected in U-Flash
- There is another device on the board assembled
- The supply voltage is too low and/or the ICSP speed is too high

