This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2540 Timer1 output gap problem

Other Parts Discussed in Thread: CC2541, BLE-STACK

Hello,

I am working on CC2541(BLE-stack 1.2.1) PWM output on channel 0, there is a gap problem in my output(pic is showing below). If i comment row-247 in OSAL_Memory.c then this problem disappear but i can not connect with host. I add rcInit() in simpleBLEPeripheral project(SBP_START_DEVICE_EVT) and comment SBP_PERIODIC_EVT. I also disable POWER_SAVING in Preprocesser option. Please can someone help me. Thank you...

theHeap[OSALMEM_BIGBLK_IDX].val = OSALMEM_BIGBLK_SZ;  // Set 'len' & clear 'inUse' field. <--- If i comment this row, there is no gap problem.

 

This is my code :

#define INPUT_CLK_FREQ      (32000000UL/32UL)

#define TIMER_TICK_FREQ_MS  (1)

#define TIMER_16BIT_VAL     ((INPUT_CLK_FREQ/1000)/TIMER_TICK_FREQ_MS)

 

void rcInit(void)

  P0SEL = 0;

  P0DIR = 0xFF;

  P2DIR = 0x9F;

  P0 = 0;

 

  // setup Timer_1

  T1CC0L = (unsigned char) (TIMER_16BIT_VAL & 0xFF);

  T1CC0H = (unsigned char) ((TIMER_16BIT_VAL >> 8) & 0xFF);

  T1CCTL0 = 0x44; // interrupt enabled, compared mode

  T1CTL = 0x06; // tick frequency/32, module mode

  T1OVFIM = 0;  // Disable overflow interrupt.

 

  T1IE = 1;

  EA = 1;

}

 

HAL_ISR_FUNCTION( T1Isr, T1_VECTOR )

  // clear interrupt flag

  T1STAT &= ~ 0x01;

 

  // toggle pin

  P0_2 ^= 1;  // should see 500 Hz at P1.0

}