• AVR Freaks

Hot!Harmony 3 blinky project runs in debug but not in production

Author
Robzored
New Member
  • Total Posts : 2
  • Reward points : 0
  • Joined: 2019/07/06 20:23:56
  • Location: 0
  • Status: offline
2019/07/10 23:07:28 (permalink)
0

Harmony 3 blinky project runs in debug but not in production

Hello all,
Newbie here who learned on the midrange pics, just starting to learn PIC32 and harmony 3.
I created a blinky project that works great in debug mode, but when I try to run it in production nothing happens. Looking through the forums I have tried the following:
-Ensuring the MCLR has a 10k pullup
-Ensuring that JTAG is disabled (both in harmony framework and a call in code)
-Ensuring the watchdog is disabled (both in harmony framework and a call in code)
I created a very simple non-harmony program that just turns on the LED and returns, and that works as expected in both debug and production, so I don't think the problem is hardware, though I have attached my schematics anyways.
Here is my code:
main
#include <stddef.h> // Defines NULL
#include <stdbool.h> // Defines true
#include <stdlib.h> // Defines EXIT_FAILURE
#include "definitions.h" // SYS function prototypes
#include <xc.h>


void TC1_CH0_TimerInterruptHandler(uint32_t status, uintptr_t context)
{
    LATA = ~LATA;
}

// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************

int main ( void )
{
   
    /* Initialize all modules */
    SYS_Initialize ( NULL );
    WDTCONbits.ON = 0;
    CFGCONbits.JTAGEN = 0;
    DDPCONbits.JTAGEN = 0;
   
    TMR1_CallbackRegister(TC1_CH0_TimerInterruptHandler, (uintptr_t)NULL);
   
    T1CONbits.ON = 1;

    while ( true )
    {
        /* Maintain state machines of all polled MPLAB Harmony modules. */
        SYS_Tasks ( );
    }

    /* Execution should not come here during normal operation */

    return ( EXIT_FAILURE );
}


initialization
/*** DEVCFG0 ***/
#pragma config DEBUG = OFF
#pragma config JTAGEN = OFF
#pragma config ICESEL = ICS_PGx1
#pragma config PWP = OFF
#pragma config BWP = OFF
#pragma config CP = OFF


/*** DEVCFG1 ***/
#pragma config FNOSC = FRCPLL
#pragma config FPBDIV = DIV_1
#pragma config FSOSCEN = OFF
#pragma config IESO = OFF
#pragma config POSCMOD = OFF
#pragma config OSCIOFNC = OFF
#pragma config FCKSM = CSDCMD
#pragma config WDTPS = PS1048576
#pragma config FWDTEN = OFF
#pragma config WINDIS = OFF
#pragma config FWDTWINSZ = WINSZ_50


/*** DEVCFG2 ***/
#pragma config FPLLIDIV = DIV_2
#pragma config FPLLMUL = MUL_24
#pragma config FPLLODIV = DIV_2

/*** DEVCFG3 ***/
#pragma config USERID = 0xffff
#pragma config PMDL1WAY = ON
#pragma config IOL1WAY = ON

 

 

/*lotta comments*/

/*******************************************************************************
  Function:
    void SYS_Initialize ( void *data )

  Summary:
    Initializes the board, services, drivers, application and other modules.

  Remarks:
 */

void SYS_Initialize ( void* data )
{
    /* Start out with interrupts disabled before configuring any modules */
    __builtin_disable_interrupts();

 
    CLK_Initialize();
 GPIO_Initialize();

    /* Configure KSEG0 as cacheable memory. This is needed for Prefetch Buffer */
    __builtin_mtc0(16, 0,(__builtin_mfc0(16, 0) | 0x3));

    /* Set the SRAM wait states to zero */
    BMXCONbits.BMXWSDRM = 0;

 


    TMR1_Initialize();

 

 

    EVIC_Initialize();

 /* Enable global interrupts */
    __builtin_enable_interrupts();


}
initialization functions
void CLK_Initialize( void )
{

    /* Default clock setting is used, hence no code is generated */
    /* Code for fuse settings can be found in "initialization.c" */

    /* Peripheral Module Disable Configuration */
    PMD1SET = 0xffffffff;
    PMD2SET = 0xffffffff;
    PMD3SET = 0xffffffff;
    PMD4SET = 0xfffffffe;
    PMD5SET = 0xffffffff;
    PMD6SET = 0xfffffffd;
}

void GPIO_Initialize ( void )
{
    /* PORTA Initialization */
    LATA = 0x0; /* Initial Latch Value */
    TRISACLR = 0x1; /* Direction Control */
    ANSELACLR = 0x1; /* Digital Mode Enable */

    /* PORTB Initialization */

 

    /* PPS Input Remapping */

    /* PPS Output Remapping */


}

void TMR1_Initialize(void)
{
    /* Disable Timer */
    T1CONCLR = _T1CON_ON_MASK;

    /*
    SIDL = 1
    TWDIS = 0
    TGATE = 0
    TCKPS = 3
    TSYNC = 0
    TCS = 0
    */
    T1CONSET = 0x2030;

    /* Clear counter */
    TMR1 = 0x0;

    /*Set period */
    PR1 = 65534;

    /* Setup TMR1 Interrupt */
    TMR1_InterruptEnable(); /* Enable interrupt on the way out */
}


I'm sure I'm missing something really dumb but this has had me stumped for days.
Thanks for any help you can provide!

Attached Image(s)

#1

4 Replies Related Threads

    ric
    Super Member
    • Total Posts : 23163
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Harmony 3 blinky project runs in debug but not in production 2019/07/17 20:43:24 (permalink)
    0
    Which PIC32MX device are you using?
    (It's always a good idea to mention the actual variant.)
     
    Are you disconnecting the PK4 after programming the code?
     
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    Robzored
    New Member
    • Total Posts : 2
    • Reward points : 0
    • Joined: 2019/07/06 20:23:56
    • Location: 0
    • Status: offline
    Re: Harmony 3 blinky project runs in debug but not in production 2019/07/18 06:50:08 (permalink)
    0
    Ack, sorry first time I tried to post the forum ate it and I completely forgot to give the device # when I rewrote
    I'm using a PIC32MX110F016B
     
    I tried removing the PK4 after programming for production, and bringing the MCLR pin low for a second with a jumper, but nothing changed.
     
    Since my original post, I started the more complicated project I had in mind when I bought the chips, and without using the Harmony framework everything seems to work great. I'm using the same circuit as I attached in the OP, plus an analog in on AN5, and the code runs properly in both debug and production, the latter with or without the PK4 in the circuit.
     
    I'll try making another harmony project similar to what I'm doing now and see how that goes.
    #3
    NorthGuy
    Super Member
    • Total Posts : 5536
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: offline
    Re: Harmony 3 blinky project runs in debug but not in production 2019/07/18 06:58:06 (permalink)
    0
    I guess this has to do something with clocking and performance settings. Compare what your project does to what Harmony does and explore the differences.
    #4
    davekw7x
    Entropy++
    • Total Posts : 1789
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Harmony 3 blinky project runs in debug but not in production 2019/07/21 11:32:06 (permalink)
    0
    Robzored
    ...stumped...!

    [Edit]
    Deleted what I now think was irrelevant
    [/Edit]
    Are you missing a ground connection on Pin 11?
     
    Since I haven't used Harmony for a "real" project, I don't think I can help you configure and use Harmony for your project.  If my suggestion doesn't help (or, maybe, even if it does) I respectfully suggest that you post additional info and request for help on the Harmony forum.  (And leave a link to that thread here.)
    [/Edit]

    Regards,

    Dave

    Footnote:
    Do not put pragma DEBUG "anything" in your code; just comment out that line.  The IDE will set it for you depending on your build.  Then you do not have to do any editing of your source between builds.  Might save some confusion.



    post edited by davekw7x - 2019/07/21 14:15:02

    Sometimes I just can't help myself...
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5