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.
//-----------------------------------------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 if( nrfx_gpiote_in_is_set( BUTTON_0_PIN ) ) { nrfx_gpiote_out_clear( LED_2_PIN ); } else { nrfx_gpiote_out_set( LED_2_PIN ); } } } void interuptTest(nrfx_gpiote_pin_t pin, nrf_gpiote_polarity_t action) { nrfx_gpiote_out_toggle( LED_1_PIN ); } //-------------------------------------------------------------------------------------------------------------------
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!