lpcware

mrt 1us resolution

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Spock on Wed Jun 12 13:24:48 MST 2013

Hi,


I just got my LPC800 mini kit and started evaluation.


My target is wireless OneWire fish tank enviromental monitor.


For support OneWire protocol I need 1us timing resolution


I've tried to perform this in following way using mrt following function:


void mrtInit(uint32_t delay)
{
  /* Enable clock to MRT and reset the MRT peripheral */
  LPC_SYSCON->SYSAHBCLKCTRL |= (0x1<<10);
  LPC_SYSCON->PRESETCTRL &= ~(0x1<<7);
  LPC_SYSCON->PRESETCTRL |= (0x1<<7);

  mrt_counter = 0;
  LPC_MRT->Channel[0].INTVAL = delay;
  LPC_MRT->Channel[0].INTVAL |= 0x1UL<<31;

  LPC_MRT->Channel[0].CTRL = MRT_REPEATED_MODE|MRT_INT_ENA;

  /* Enable the MRT Interrupt */

  NVIC_EnableIRQ(MRT_IRQn);
  return;
}


However passing values less than 60 as a function parameter gives result in not working system.


Above thise value timer works properly and I can see test quare wave on my oscilloscope.


What might be a problem ?

Outcomes