News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

Pic33 series configuration problem

Started by xvovanx, Apr 21, 2024, 05:39 PM

Previous topic - Next topic

xvovanx

Hello!

There's a problem. When compiling the Pic18 series and loading the hex file into the PICkit3 programmer, everything is OK, the configuration from Positron is loaded. But with Pic33 series program there is a problem. I do the configuration in Positron using a plugin.
Why doesn't pickit3 load the configuration from 33pic Positron compiled hex file without Mplab software use?

normnet

 The following config is for a similar device number for some ideas:

   Device = 33FJ128GP802
   Declare Xtal = 79.23 
  ' Configure for internal 7.37MHz oscillator with PLL
  ' OSC pins are general purpose I/O
   Config FBS = BWRP_WRPROTECT_OFF
   Config FGS = GWRP_OFF
   Config FOSCSEL = FNOSC_FRCPLL, IESO_OFF
   Config FOSC = POSCMD_NONE, OSCIOFNC_ON, IOL1WAY_OFF, FCKSM_CSECME
   Config FWDT = WDTPOST_PS256, WINDIS_OFF, FWDTEN_OFF
   Config FPOR = FPWRT_PWR1, ALTI2C_OFF
   Config FICD = ICS_PGD1, JTAGEN_OFF

Gamboa

Hi,
For a DSPIC33FJ128GP706A I have the following configuration:

'*************************************************************************
'** FUSES
'*************************************************************************
  CONFIG FBS = BWRP_WRPROTECT_OFF, BSS_NO_BOOT_CODE, RBS_NO_BOOT_RAM     'F80000  FBS
  CONFIG FSS = SWRP_WRPROTECT_OFF,SSS_NO_SEC_CODE, RSS_NO_RAM            'F80002  FSS
  CONFIG FGS = GWRP_OFF,GSS_HIGH                                         'F80004  FGS
  CONFIG FOSCSEL = FNOSC_FRCPLL, IESO_OFF                                'F80006  FOSCSEL, FRC + PLL, arranca con oscilador elegido por usuario
  CONFIG FOSC = POSCMD_NONE, OSCIOFNC_ON, FCKSM_CSDCMD                   'F80008  FOSC
  CONFIG FWDT = WDTPOST_PS256, WINDIS_OFF, FWDTEN_OFF                    'F8000A  FWDT
  CONFIG FPOR = FPWRT_PWR1                                               'F8000C  FPOR
  CONFIG FICD = ICS_PGD1, JTAGEN_OFF                                     'F8000E  FICD

With MPLAB IPE I get the same configuration in each configuration register.

Regards,
Gamboa



Long live for you

Stephen Moss

Quote from: xvovanx on Apr 21, 2024, 05:39 PMWhy doesn't pickit3 load the configuration from 33pic Positron compiled hex file without Mplab software use?
I am not sure if this will work as I have never tried it, but I think it should...
1) Set the fuse configurator to produce the assembler output
2) Compile a program that only contains some randomly set the fuse data (no program code), if the issue persists...
3) Try scrolling down the PICkit softwares code windows until you get to values that will not be the dafault (FFFF and/or 0000). If the fuse data is included the code window then that is what you should be seeing, compare with the values produced by the Fuse Configurator as shown in the Positron IDE to verify.

If you can confirm that the fuse values are present does the address location shown match that given in the datasheet?
If not then it is possible the address is incorrect in the devices PPI or DEF file used by the compiler so try checking those incase an error has crept in placing the configuration data at the wrong address, otherwise the issue probably lies with the Programmer software.
If you are be using the Microchip PICKit2/3 programming software then it would be worth changing your programmer software anyway as there have been no updates/support for newer device added for the PICkit2 & 3 programmers from Microchip for several years now since the PICkit 4 programmer came out.
 
Some people here use PICkitPlus by Even Venn instead, while others use use PICkitminus. Certainly PICkitPlus (and I belive PICkit minus) extends the use of the PICKit 2 & 3 programmers by adding support for the newer PIC devices comming out, therby preventing the need to upgrade to a PICKit4 or 5 in order to program the latest Microchip devices.

Yasin

In Les' recent examples, he adds the Fuses settings at the end of the program. Maybe this may have become a necessity for Pic33s. Try adding the fuse settings to the end of the program.

For example https://protoncompiler.com/index.php/topic,2116.msg16269/topicseen.html#msg16269

top204

I'm not seeing any config fuse problems when using a U2 programmer with the dsPIC33 device.

The Configs can be anywhere within the program listing, because they are scanned, stored, then passed directly to the assembler/linker in the assembler code file. So when the program is assembled and linked into the HEX file, the config fuses are in there.




xvovanx

#6
Hello!
My results: I created an empty program with only a configuration - everything was ok, the configuration was loaded into Pickit3.
But with a large program there is an error - the program text is written to the configuration addresses F80000-F8000E.
How can these addresses be reserved in Positron so that the program does not fall into them?

Gamboa

Hi,

I compiled my program for the 33FJ256GP710A micro with the configuration I had and it compiled fine. I then started the IPE programming tool connected to a pickit4 and it loaded the configuration without problems. My compiler is version 1.1.1.7.

Regards,
Gamboa
Long live for you

xvovanx

#8
Unfortunately the MPLAB IPE won't connect to the controller with my PICkit3, so I'm program it using the PicKit3 Programmer.
How can you programmatically reserve this area of memory so that the program does not end up in these addresses during programming?

trastikata

#9
Quote from: xvovanx on Apr 23, 2024, 07:27 PMUnfortunately the MPLAB IPE won't connect to the controller with my PICkit3, so I'm program it using the PicKit3 Programmer.

No way MPLABX won't connect and PicKit3 Programmer does, check your power settings!

Do you power the device from PicKit3? If yes, verify if "Power target circuit from PicKit3" in MPLABX is checked and if the voltage is correct. Or if the device is not supposed to be powered from the programmer, then remove that check from "Power target circuit from PicKit3" - if the circuit draws too much current, Pickit3 might refuse to work.

Positron outputs "compressed" hex files omitting empty program spaces, which is no problem as long as the programming software can read and organize the block and address structure correctly, which is no problem for MPLABX.

:020000040000fa
:08000000f809040000000000f3
:020000040000fa
:020000040002f8
:04afe000dfff00008f
:020000040000fa
:020000040002f8
:04afe400ffff00006b
:020000040000fa
:020000040002f8
:04afe8007eff0000e8
:020000040000fa
:020000040002f8
:04afec005eff000004
:020000040000fa
:020000040002f8
:04aff000bbff0000a3
:020000040000fa
:020000040002f8
:04aff400ffff00005b
:020000040000fa
:1000080000000000000000000000000000000000e8
:10001800f0090000000000000000000000000000df
:1000280000000000000000000000000000000000c8
:1000380000000000000000000000000000000000b8

Take a look in this HEX file snippet how positron is switching back and forward between 0KB (020000040000fa) space and extended 128KB (020000040002f8) space. MLABX can read that and organize the file and program it.

Just to resolve your issue, open MPLABX, set the correct PIC device, load the positron file in MPLABX, then click File-->Export-->HEX. The newly created file should be complete memory image which you can load now.

xvovanx

Hello!
Thank you all for your help, I solved my problem  :D .
I used the MPLAB IPE program as a converter, I opened and resaved the programs hex file and the pic configuration addresses fell into place.

P.S. I will program as before using the PICkit3 Programmer program, it works much more stable and reliable than MPLAB IPE, and is not capricious with the output voltage of the laptop's USB port.