• AVR Freaks

Problem in code generated by Harmony in clock configuration in ATSAME54P20 controller

Author
sameer_khanna
New Member
  • Total Posts : 13
  • Reward points : 0
  • Joined: 2014/03/04 04:55:40
  • Location: 0
  • Status: offline
2020/02/14 23:39:33 (permalink)
0

Problem in code generated by Harmony in clock configuration in ATSAME54P20 controller

Hello,
 
I am using SAME54 X plained pro board.  I created a new Harmony projected and try to toggle LED on PC18 pin of micro but when I run code then I found that code is stuck in following part of code in file  "plib_clock.c" and not reaching to "while(1)".
 
I think there is some problem in clock configuration but I am using default clock configuration generated by Harmony tool. so please help to solve the issue.   
 
/**************************************************************************************************/
/* Enable DPLL */
    OSCCTRL_REGS->DPLL[0].OSCCTRL_DPLLCTRLA = OSCCTRL_DPLLCTRLA_ENABLE_Msk   ;

    while((OSCCTRL_REGS->DPLL[0].OSCCTRL_DPLLSYNCBUSY & OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk) == OSCCTRL_DPLLSYNCBUSY_ENABLE_Msk )
    {
        /* Waiting for the DPLL enable synchronization */
    }

    while((OSCCTRL_REGS->DPLL[0].OSCCTRL_DPLLSTATUS & (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk)) !=
                (OSCCTRL_DPLLSTATUS_LOCK_Msk | OSCCTRL_DPLLSTATUS_CLKRDY_Msk))
    {
        /* Waiting for the Ready state */
    }
/****************************************************************************************/
//This is main code in main.c file
#include <stddef.h>                     // Defines NULL
#include <stdbool.h>                    // Defines true
#include <stdlib.h>                     // Defines EXIT_FAILURE
#include "definitions.h"                // SYS function prototypes


// *****************************************************************************
// *****************************************************************************
// Section: Main Entry Point
// *****************************************************************************
// *****************************************************************************
void delay(void);

int main ( void )
{
    /* Initialize all modules */
    SYS_Initialize ( NULL );

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

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

    return ( EXIT_FAILURE );
}
 
void delay(void)
{
  unsigned int i,j;
   for(i=0;i<65000;i++)
   {
     for(j=0;j<65000;j++)
      {
       ;
      }
   }
}
 
#1

0 Replies Related Threads

    Jump to:
    © 2020 APG vNext Commercial Version 4.5