Question on interrupt process in nRF52840

I want to confirm these questions,hope someone can give me some explaination.

1) RADIO has it's own kernal which is some kind of MCU.

I have looked through some doc on BLE chips, most of them are dual kernal:one for layers higher,and one for RADIO phy, is nRF52840 same?

2) Interrupt process structure.

I did not find much info on this subject in datasheet(S140_SDS_v2.1.pdf):

"6.1.8 Interrupts"

"the peripheral with ID=4 is connected to interrupt number 4 in the nested vectored interrupt controller(NVIC)."--NVIC preseted.

"6.8 EGU — Event generator unit"

"or to handle a peripheral's interrupt service routine (ISR) execution at a lower priority for some of its events"

"Up to 16 separate event flags per interrupt for multiplexing"

All just mention,no so much details.I believe the whole structure is powerful.

The most important thing for me is:

Can I keep some interrupt not interrupted by other interrupt, or not delay too long.

For example,I want to receive the IR signal(PWM,40K/50K),interrupts from them should not delayed too long,and I want to send IR signal too.Thery are executed through interrupt handler.

It should be OK if RADIO has its own kernal,not rely on the same kernal to process.

3) Can I directly use interrupt handler instead of events?

4) Can I freely set priorities for each interrput?

Thank you.   

  • OK,I will try to use connect SDK later.

    And,sorry,I mixed the application,for gateway, no IR send & receive function.

    Only BLE peripherals have IR functions,and for peripherals, the connection count is very few,so timeslot is long enough.

    But,from technical view,it will be perfect if I can use peripheral instead of CPU to finish the job.

    Just forget IR function,it is PWM application.

    What the difference is: 

    All examples just need to update the compare values when time is up.

    In my case,I need not only update the compare values,but also need switch on/off PWM.

    The output looks like this(Pulse width modulation):

    preamble                                             1                                               0                                      1             ...

    PWM_1200us  SPACE_300us   PWM_600us  SPACE_300us PWM_300us  SPACE_300us PWM_600us  SPACE_300us   ...

    _-_-_-_-_-_-_-_-_-  [space]_-_-_-_-_-_-[space]_-_-_-[space] _-_-_-_-_-_-       

     

    Need 2 timers to finish the job at least: 1 outputs PWM, 1 control the interval.

    The problem is the PWM output is not continuous,we need to switch it once per bit.

    I don't figure out the way without interrupt handler.

    Anyway,this is my application problem,not chip or SDK technical problem,you can just ignore it.

  • I get the way, I limited my thought before. "switch" is to change the value of register at last,it is same with changing compare values.

    Maybe I need use 3 DMA channels.

    The data array:

    tick:            1200  300  600  300 300  300 ...

    pwmOnOff: 1        0      1      0     1      0    ...

    pinLevel:     0        0      0      0     0      0    ...

    After switched off PWM,we need make sure the pinLevel is low,so set it low every time.

    tick -> timer_B               -> DMA.channel_B

    pwmOnOff  -> timer_A  ->  DMA.channel_A

    pinLevel  -> pin_out      ->  DMA.channel_C

    trigger flow:

    pin_out = low

    timer_B.cv = 1200

    timer_A.en = 1

    timer_B.en = 1 ---->Int                                                                        ----->Int

                                         -> DMA.channel_B move 300 to timer_B.cv             ->repeat

                                         -> DMA.channel_A move 0 to timer_A.en

                                         -> DMA.channel_C move 0 to pinLevel

    It should work,I will study the hardware drivers.

    Thank you for help.

  • Just read the introduction of PPI 如何理解nRF5芯片外设PPI - Nordic Semiconductor中文官网.

    Thing will get simpler.

    Maybe I can do like this:

    timerA: pwm
    timerB: control interval
    pinPWM=P0.11: pin to output PWM
    DMA_CHn: load compare value to timerB

    timerB interrupt(event)
         ->(task)DMA_CHn load cv to timerB
         ->(task)PPI_CH[0].TASK_toggle_timerA(event)
                         ->(task)PPI_CH[1].TASK_CLR_pinPWM(event)
                                               ->(task)GPIOTE.TASK_CLR_pinPWM

    1)timerB timeout event trigger a)DMA to load new compare value to timerB; b)switch PWM(tmerA) output;

    2)switch PWM output will be the event to trigger clear pinPWM;

    3)clear pinPWM will trigger the action to clr pinPWM port.

Related