GPIOTE interrupt not fast enough

Hi guys. I am using nRF52840. Currently, I want to read out an image from a camera. The camera PCLK is toggled at 500Khz, and what I want to do is to trigger an interrupt every time the PCLK goes HIGH or RISING EDGE. However, I noticed that GPIOTE cannot go fast enough. Here is a waveform of PCLK and a test pin I set, test pin will toggle as long as gpiote detects a rising edge. 

 I need to use this interrupt to assemble the data from the camera D0 -D7, if this is the speed, it will cause me to lose a ton of pixels. Is there a way that I can trigger the interrupt faster?

void gpio_init()
{

    ret_code_t err_code; // hold error value


    nrf_gpio_cfg_output(TEST_PIN);
    nrf_gpio_pin_clear(TEST_PIN);


    nrf_drv_gpiote_in_config_t  in_line_config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true); 
    in_line_config.pull = NRF_GPIO_PIN_NOPULL;

    err_code = nrf_drv_gpiote_in_init(LINE_VALID, &in_line_config, input_line_handle); // Initialize the interrupt pin 
    APP_ERROR_CHECK(err_code);


    nrf_drv_gpiote_in_event_enable(LINE_VALID, true); 

    
}


void input_line_handle(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    nrf_gpio_pin_toggle(TEST_PIN);
}

Parents
  • Hi 

    Which SDK version are you using?

    Possibly the delay here is caused by the wakeup latency, and it might be possible to make it faster, but if you need to process the input every 2us I think the interrupt latency will be too slow regardless. 

    The only way I can see to read the data this fast is to read the clock line in a while loop, and read the data pins as soon as you see the clock go high. 

    For this to work you need to avoid any other interrupts while the camera transfer is happening, as even the shortest of interrupts will cause you to lose one or more clock periods. 

    This means it is very limited what kind of other activities you can have going on (such as running any wireless communication) while the camera sensor is being read. 

    For a more robust solution you could consider finding some kind of parallel to SPI converter, that can convert the parallel output of the camera sensor to an SPI stream. The SPI interfaces have a DMA feature that allow them to send/receive data seamlessly in the background, with very little CPU interaction needed. 

    Best regards
    Torbjørn

Reply
  • Hi 

    Which SDK version are you using?

    Possibly the delay here is caused by the wakeup latency, and it might be possible to make it faster, but if you need to process the input every 2us I think the interrupt latency will be too slow regardless. 

    The only way I can see to read the data this fast is to read the clock line in a while loop, and read the data pins as soon as you see the clock go high. 

    For this to work you need to avoid any other interrupts while the camera transfer is happening, as even the shortest of interrupts will cause you to lose one or more clock periods. 

    This means it is very limited what kind of other activities you can have going on (such as running any wireless communication) while the camera sensor is being read. 

    For a more robust solution you could consider finding some kind of parallel to SPI converter, that can convert the parallel output of the camera sensor to an SPI stream. The SPI interfaces have a DMA feature that allow them to send/receive data seamlessly in the background, with very little CPU interaction needed. 

    Best regards
    Torbjørn

Children
No Data
Related