This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

interrupt entry time and interrupt disable ( nRF52 DK + image sensor )

Hi,

I am testing that nRF52832 transfer QVGA still image from image sensor to phone as follows.

  1. nRF52832(nRF52 DK) is connected with image sensor through some signals(8bit data bus, MCLK, PCLK, HSYNC and VSYNC..)

  2. Initialize pin change interrupt by VSYNC signal.

  3. When user push button, nRF52 DK read QVGA still image from image sensor in VSYNC interrupt service routine.

  4. nRF52 DK transfer image to phone by Bluetooth.

Then, I have two problems so I ask some questions to you.

First, for pin change interrupt,

Interval between H/W external interrupt(VSYNC interrupt) generation time and interrupt service routine(pin change interrupt) entry time is about 7.6us(B), but it should be under 0.4us in our project.
Also, I had test it in GPIOTE_IRQHandler() but the interval is 2.4us(A).

If you have any solution that can decrease interval to under 0.4us, please let me know it.

image description

HSYNC_IN => HSYNC interrupt signal from image sensor

DBG_PORT0 => Debug signal which I add in GPIOTE_IRQHandler() start position

DBG_PORT1 => Debug signal which I add in HSYNC interrupt service routine(pin change int)

Second, VSYNC interrupt service routine should not be disturbed by any other interrupt for about 200ms because image sensor output image data by only VSYNC, HSYNC and PCLK timing irrespective of nRF52832.

Then it seems that other interrupt (RF interrupt?) is disturbing VSYNC interrupt.

I had changed interrupt priority to Low - High, but read image have noise lines.

Also I had changed it to Highest but nRF52832 is not working.

Do you have any solution that other interrupt does not disturb VSYNC interrupt? (ex. : RF off => read image data from interrupt => RF on => tx data to phone..)

Parents
  • No, and this is constantly discussed here, you cannot do hard realtime operations using interrupts with the softdevice running. It has a higher priority interrupt than anything else because it has hard timing requirements to keep the bluetooth link going and so it will interrupt you.

    When you say you changed the interrupt priority to 'highest' do you mean '0'? Because that interrupt priority isn't available to user code when you're using the softdevice, because it needs to be able to interrupt you. So if you did use 0 and set it before starting the softdevice, it will have errored and not started, if you enabled it afterwards, chances are you delayed the softdevice interrupt long enough that it failed internal timing checks and faulted.

    The softdevice spec tells you that interrupt latency is <2us with the softdevice running. So you're not likely to get 0.4us, you'll get something close to 2us as long as the softdevice isn't already doing something it needs to finish.

    Your VSYNC interrupt handler can't be guaranteed not to be disturbed, in fact at 200ms you can pretty much guarantee that in any kind of connection it will be disturbed, more than once. Unless you can use a hardware solution such as DMA, you can't do what you're trying to do. Since you mention 8bit data, there is no parallel data peripheral on the nRF52 so there probably isn't a hardware/DMA solution available.

    There is a timeslot API which will give you free access with no interrupts to all the resources, however you get the slot when the softdevice decides to give it to you, you can't control it, so I doubt that would work for you either.

    Probably your only solution here is to find a separate chip which will read the parallel data when the VSYNC trigger arrives and store it, and then let you read it off using SPI or I2C or some other interface.

Reply
  • No, and this is constantly discussed here, you cannot do hard realtime operations using interrupts with the softdevice running. It has a higher priority interrupt than anything else because it has hard timing requirements to keep the bluetooth link going and so it will interrupt you.

    When you say you changed the interrupt priority to 'highest' do you mean '0'? Because that interrupt priority isn't available to user code when you're using the softdevice, because it needs to be able to interrupt you. So if you did use 0 and set it before starting the softdevice, it will have errored and not started, if you enabled it afterwards, chances are you delayed the softdevice interrupt long enough that it failed internal timing checks and faulted.

    The softdevice spec tells you that interrupt latency is <2us with the softdevice running. So you're not likely to get 0.4us, you'll get something close to 2us as long as the softdevice isn't already doing something it needs to finish.

    Your VSYNC interrupt handler can't be guaranteed not to be disturbed, in fact at 200ms you can pretty much guarantee that in any kind of connection it will be disturbed, more than once. Unless you can use a hardware solution such as DMA, you can't do what you're trying to do. Since you mention 8bit data, there is no parallel data peripheral on the nRF52 so there probably isn't a hardware/DMA solution available.

    There is a timeslot API which will give you free access with no interrupts to all the resources, however you get the slot when the softdevice decides to give it to you, you can't control it, so I doubt that would work for you either.

    Probably your only solution here is to find a separate chip which will read the parallel data when the VSYNC trigger arrives and store it, and then let you read it off using SPI or I2C or some other interface.

Children
Related