LockedHot!XC32 compiled program does not work

Author
ogremage
New Member
  • Total Posts : 11
  • Reward points : 0
  • Joined: 2016/11/26 01:24:43
  • Location: 0
  • Status: offline
2017/04/30 13:02:54 (permalink)
0

XC32 compiled program does not work

Dat firewall
#1

19 Replies Related Threads

    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:07:29 (permalink)

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #2
    ogremage
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2016/11/26 01:24:43
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:13:59 (permalink)
    +1 (1)
    http://picforum.ric323.com/viewtopic.php?f=16&t=410
     
    Hope this will defeat damn firewall...
    #3
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:43:13 (permalink)
    0
    Yep, this could be an issue:
    #pragma config DEBUG = ON // Background Debugger Enable
    (I see it has been replied in there too, of course grin )

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #4
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:45:01 (permalink)
    0
    Again, I'm facing this issue. I've got PIC32MX530F064H and a very basic led blinking program:

    //#include <p32xxxx.h> // for C32
    #include <xc.h> // for XC32

    #pragma config FPLLIDIV = DIV_2 // PLL Input Divider
    #pragma config FPLLMUL = MUL_20 // PLL Multiplier
    #pragma config UPLLIDIV = DIV_2 // USB PLL Input Divider (POSC = 8 Mhz, USB must be supplied with 4 Mhz)
    #pragma config UPLLEN = ON // USB PLL Enabled
    #pragma config FPLLODIV = DIV_1 // System PLL Output Clock Divider

    #pragma config FNOSC = PRIPLL // Oscillator Selection - primary OSC w/Pll (XT+,HS+,EC+PLL)
    #pragma config FSOSCEN = OFF // Secondary Oscillator Enable (KLO was off)
    #pragma config IESO = OFF // Internal/External Switch-over
    #pragma config POSCMOD = HS // Primary Oscillator Configuration - HS osc mode

    #pragma config OSCIOFNC = OFF // CLKO Output signal active on the OSCO Pin
    #pragma config FPBDIV = DIV_2 // Peripheral Clock divisor
    #pragma config FCKSM = CSDCMD // Clock Switching & Monitor Selection - Clk Switch enable, FSCM disable

    #pragma config WDTPS = PS1 // Watchdog Timer Postscale - 1:1
    #pragma config FWDTEN = OFF // Watchdog Timer Enable

    #pragma config CP = OFF // Code Protect
    #pragma config BWP = OFF // Boot Flash Write Protect
    #pragma config PWP = OFF // Program Flash Write Protect
    #pragma config ICESEL = ICS_PGx1 // ICE/ICD Comm Channel Select
    #pragma config DEBUG = ON // Background Debugger Enable

    int main ( void )
    {
        TRISDbits.TRISD6 = 0; // LED 1
        TRISGbits.TRISG6 = 0; // LED 2

        while (1) {
            LATDbits.LATD6 = 1;
            LATGbits.LATG6 = 0;
        }
    }
     

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #5
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:48:12 (permalink)
    0



    I certainly can go along with an older C32, but I want to test Harmony framework, and it supports only XC32, as far as I know. Btw, when I load a sample harmony project   (CDC), MCU doesn't go into reboot, but it just ignores my code and always fires both LEDs, even if I force them to be off in the program.

    MplabX version: 3.60
    XC32 version: 1.43
     

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #6
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:49:14 (permalink)
    0
    It runs successfully when is compiled with C32 compiler and goes into an endless reboot cycle, when is compiled with XC32. I didn't change anything in both compilers'    settings. But there must be a subtle difference between them that affects my program. Or it's just a pure black m.

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #7
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 13:50:19 (permalink)
    0
    ahah it was the b l a c k m a g i c
    the forbidden word grin !!! funny... it's something I perform on a daily basis against "bad people"... ! ;)
     

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #8
    ogremage
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2016/11/26 01:24:43
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 14:12:10 (permalink)
    +1 (1)
    Some bad firewalls need it too. But, let's concentrate on another, safe, forum. Turning off DEBUG doesn't help very much.
    #9
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 14:17:58 (permalink)
    0
    wink
    Have got no other clues. I'd make those led toggle rather than steady, in the loop, but you state it's not the issue...
     
    I'd think about CONFIG settings, but those look good enough

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #10
    ogremage
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2016/11/26 01:24:43
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 14:28:26 (permalink)
    0
    Then it's almost certain a ma-gic.
     
    I thought that maybe I need to set some special compiler or linker settings. Btw, I'm using bootloader to re-program. But on the other hand, if I program with wrong settings, it should overwrite my bootloader, but it's still working.
    #11
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 14:35:55 (permalink)
    0
    Oh but then it must be something in the linker file for the bootloadable HEX! (I considered this for a moment and then skipped it)
     
    You should try with just the new code, and then get back to the bootloadable Project

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #12
    timijk
    Super Member
    • Total Posts : 1215
    • Reward points : 0
    • Joined: 2007/11/26 00:30:07
    • Location: Taiwan
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 15:38:43 (permalink)
    0
    I was using the PIC32MX270F256D, I have seen a strange issue about the "DEBUG<1:0>" settings.
     
    If I use "#pragma config DEBUG = OFF", the compiled HEX bits is set to "10".  It makes my PIC not functioning.
     
    I found if I remove the line, the compiled HEX bits will be "11", that would be OK.
     
     
    #13
    qhb
    Superb Member
    • Total Posts : 6262
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 15:46:42 (permalink)
    +1 (1)
    I don't know why the debug bits are even defined in the header file.
    I'm not aware of any case where it's appropriate for a user to touch them at all.
     
    #14
    timijk
    Super Member
    • Total Posts : 1215
    • Reward points : 0
    • Joined: 2007/11/26 00:30:07
    • Location: Taiwan
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 16:04:21 (permalink)
    +1 (1)
    qhbI don't know why the debug bits are even defined in the header file.
    I'm not aware of any case where it's appropriate for a user to touch them at all.

     
    That's true.
     
    I found the issue, because I used the MPLAB X IDE to generate the configurations bits, it doesn't generate the "DEBUG" pragma statement.  When I used MCC to generate the codes, it generates the "DEBUG" pragma statement, and it causes the problem.  It took me hours to find this issue...
    #15
    ogremage
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2016/11/26 01:24:43
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/04/30 22:13:32 (permalink)
    0
    I've already turned off DEBUG.
    The problem is that I don't have any linker file, just a `main.c` file and that's all. If I uncomment the first line and comment the second (where includes are) and compile it with C32 - it works fine. If I do vice versa and choose XC32 - it fails. There're no special bootloader projects. Maybe C32 uses some linker file internally?
    #16
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/05/01 01:46:49 (permalink)
    0
    I see, then well it could be the case.
    In theory (my experience with PIC32 is limited) you always need to "do something special" in order to get a bootloadable HEX..

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #17
    ogremage
    New Member
    • Total Posts : 11
    • Reward points : 0
    • Joined: 2016/11/26 01:24:43
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/05/01 11:40:28 (permalink)
    +1 (1)
    The problem is now solved. I've just used PICkit3 instead of bootloader.
    Maybe I need to adapt bootloader from mikroE somehow, but that's another story...
    #18
    CinziaG
    morite
    • Total Posts : 3142
    • Reward points : 0
    • Joined: 2016/12/07 14:20:36
    • Location: Wien
    • Status: offline
    Re: XC32 compiled program does not work 2017/05/01 12:00:44 (permalink)
    0
    Good Smile

    get my books!
    lulu.com search.ep?keyWords=greggio&type=
     
    #19
    john.wilson
    Starting Member
    • Total Posts : 27
    • Reward points : 0
    • Joined: 2011/02/21 10:39:57
    • Location: 0
    • Status: offline
    Re: XC32 compiled program does not work 2017/07/28 08:41:54 (permalink)
    +1 (1)
    I'm confused why you're confused. The program as shown does not blink anything - just perpetually turns D6 ON and G6 OFF. Were you expecting something else?
    #20
    Jump to:
    © 2018 APG vNext Trial Version 4.5