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

nRFX lib - Problem with interupt and timer

Hi,

I use a mcu nRF52840 on a personal card for a project and we are stuck on interruptions: hardware pin and timer. I use the lib "nrfx" for future accounting purposes. I took the example code from the library "nrf" located at

*nRF5_SDK_15.3.0_59ac345\examples\peripheral\pin_change_int*

and I converted it with the nrfx library.

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//-----------------------------------------CODE--------------------------------------------------------------
#include <nrfx.h>
#include <nrfx_gpiote.h>
#include "bsp.h"
#include "system_nrf52840.h"
void interuptTest(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action);
void main(void)
{
SystemInit();
bsp_init();
// Configure the interupt on button 0
nrfx_gpiote_init();
nrfx_gpiote_in_config_t button_0_config = NRFX_GPIOTE_CONFIG_IN_SENSE_HITOLO( true );
nrfx_err_t test = nrfx_gpiote_in_init( BUTTON_0_PIN , &button_0_config, interuptTest );
nrfx_gpiote_in_event_enable( BUTTON_0_PIN , true );
while ( true )
{
// Make sure that the button is detected
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

The execution of this code does not cause any interruption, however, LED number 2 changes state when button 0 is pressed, which attests to the change in the state.

Given the problems I have with both the hardware and timer interruptions, we must have missed a step in the configuration of the mcu. Can you enlighten me on this subject? What more needs to be done to allow interruptions?

Another question: I can't find an example with the nrfx library. Is that normal? Do you have a link to "official" examples using this library?

Thank you very much!