Hi All,
I am using NRF51822 chip pca10001 development board.
I flashed ble_app_hrs application to the board.
I configure 3 channel for PPI.
static void ppi_init(void)
{
uint32_t err_code;
err_code = sd_ppi_channel_assign(0,
&(NRF_TIMER2->EVENTS_COMPARE[0]),
&(NRF_GPIOTE->TASKS_OUT[0]));
APP_ERROR_CHECK(err_code);
err_code = sd_ppi_channel_assign(1,
&(NRF_TIMER2->EVENTS_COMPARE[1]),
&(NRF_GPIOTE->TASKS_OUT[0]));
APP_ERROR_CHECK(err_code);
err_code = sd_ppi_channel_assign(2,
&(NRF_TIMER2->EVENTS_COMPARE[1]),
&(NRF_TIMER2->TASKS_CLEAR));
APP_ERROR_CHECK(err_code);
}
I configure gpiote task for channel 0.
void gpiote_channel_0_set(void)
{
nrf_gpiote_task_config(0, AC_OUT_PIN, NRF_GPIOTE_POLARITY_TOGGLE, \
NRF_GPIOTE_INITIAL_VALUE_HIGH);
}
Now i enable all 3 channels.
__inline void ppi_enable(void)
{
uint32_t err_code;
err_code = sd_ppi_channel_enable_set( (PPI_CHEN_CH0_Msk) | (PPI_CHEN_CH1_Msk)| (PPI_CHEN_CH2_Msk));
APP_ERROR_CHECK(err_code)
}
The timer2 is intialised as fallows.
static void timer2_init(void)
{
/* Start 16 MHz crystal oscillator */
NRF_CLOCK->EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK->TASKS_HFCLKSTART = 1;
/* Wait for the external oscillator to start up */
while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0)
{
// Do nothing.
}
NRF_TIMER2->TASKS_CLEAR = 1;
NRF_TIMER2->MODE = TIMER_MODE_MODE_Timer;
NRF_TIMER2->PRESCALER = 4;
/* Load initial values to Timer 2 CC registers */
/* Set initial CC0 value to anything > 1 */
NRF_TIMER2->BITMODE = TIMER_BITMODE_BITMODE_16Bit;
}
Now i am updating timer2 cc0 value and cc1 value from BLE characteristic interrupt and then i start the timer.
But for constant cc0 and cc1 value its giving two waveform.
ex- cc0=1000(1ms), cc1=10000(9ms);
i am getting two wave
-
1ms on and 9ms off.
-
1ms off and 9ms on.
I need to get only first wave all the time if i write constant value to ble characteristic
Could any one tell me how to solve this?. ( I need to do this with PPI only).
I tried by reinitialising all ppi and gpiote for every ble characteristic interrupt then also it dont work.
Kindly tell me what is the issue.
Regards Punit