subodh
subodh

Reputation: 9

Microcontroller stops responding after accessing registers of uninitialized peripheral

I am working on ARM cortex M3 processor. After accessing MCPWM register controller stops responding in which no interrupts will work. Intentionally I have not initialise MCPWM. So i wanted to know, where actually code flow(Program counter) goes, reason of controller hang.

Upvotes: -1

Views: 142

Answers (2)

subodh
subodh

Reputation: 9

void MCPWM_IRQHandler(void)
{
  uint32_t TempRegVal;
  TempRegVal = LPC_MCPWM->INTF;  //PC was pointing here after code stuck
  if(TempRegVal & ILIM1)
  {                                                                                               
  }                                                                                                              
  if(TempRegVal & ILIM2)
  { 
  }
  LPC_MCPWM->INTF_CLR = TempRegVal; //Interrupt flag cleared
  return;
}

Any Idea why interrupt flag not getting cleared or is there any other best way to clear this flag?

Upvotes: 0

subodh
subodh

Reputation: 9

Thanks for reply..

I am using LPC17xx series.

{    
LPC_SC->PCONP |= 0x00020000;             
LPC_PINCON->PINSEL3 |= (0x01<<18)| 
(0x01<<24);
LPC_MCPWM->TC2 = 0;
LPC_MCPWM->LIM2 = 2048;
LPC_MCPWM->MAT2 = 1024;

  LPC_MCPWM->CON_SET = 1 << 17;
   LPC_MCPWM->CON_SET = 1 << 18;
   LPC_MCPWM->CON_CLR = 1 << 19;

   LPC_MCPWM->DT &= ~(0x3FF << 20);
  
   LPC_MCPWM->DT |= (channelSetup- 
   >channelDeadtimeValue & 0x3FF) << 20;


   LPC_MCPWM->CON_CLR = 1 << 20;
   NVIC_EnableIRQ(MCPWM_IRQn);

   LPC_MCPWM->INTEN_SET = 0x01 << 8;
}

This is part of the code which is used to initialize MCPWM But intentionally this code is commented and controller hang after executing below code which is used to stop MCPWM

{
    regVal |= (1 << 16);

    LPC_MCPWM->CON_CLR = regVal;

  }

I will buy debugger to monitor fault registers.

Upvotes: 0

Related Questions