Hi,
I need to capture a demodulated, manchester encoded signal (16 bits long). The data rate is about 50kHz (give or take). Currently, I am configuring a PPI with timer1 and the pin interrupt. When the interrupt routine is generated, I retrieve the value stored in the capture. I am aware that this will only work if I retrieve the stored value before the next interrupt is generated. The problem is that the signal is faster than the interrupt.
Here is my code:
// Interrupt Routine void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { nrf_drv_gpiote_out_toggle(TP1); }
void init_sig_anal(void){ uint32_t err_code; uint32_t gpiote_evt_addr; uint32_t capture_task_addr;
// Initialise GPIO if not already done so
if(!nrf_drv_gpiote_is_init()){
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
}
// Set pin TP1 as output
nrf_gpio_cfg_output(TP1);
// Set interrupt to trigger on both rising and falling edge
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
// Set internal pullup resistor
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(TAG_TX, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
// Initialise the PPI
err_code = nrf_drv_ppi_init();
APP_ERROR_CHECK(err_code);
// Allocate ppi_channel_1 and check that it is available
err_code = nrf_drv_ppi_channel_alloc(&ppi_channel1);
APP_ERROR_CHECK(err_code);
// Get the timer task address for NRF_TIMER_TASK_CAPTURE1
capture_task_addr = nrf_drv_timer_task_address_get(&timer, NRF_TIMER_TASK_CAPTURE1);
// Get the interrupt address for pin TAG_TX
gpiote_evt_addr = nrf_drv_gpiote_in_event_addr_get(TAG_TX);
// Assign the capture and interrupt to the PPI channel
err_code = nrf_drv_ppi_channel_assign(ppi_channel1, gpiote_evt_addr, capture_task_addr);
APP_ERROR_CHECK(err_code);
// Enable the PPI channel
err_code = nrf_drv_ppi_channel_enable(ppi_channel1);
APP_ERROR_CHECK(err_code);
}
Does anyone know how I could capture all the edges and the time difference between edge captures or speed up the interrupt?
Thanks, James