Problems with GPIO P1.xx on nRF52833

We recently changed from nRF52832 to nRF52833 and for layout convenience used some of the P1.xx pins for our signals.

We are using SDK ver: nRF5_SDK_17.0.2_d674dde

For some reason I don't understand we are experiencing problems whenever a P1.xx GPIO is configured the application crashes. On some board we have just simple enable signals and on another boards we have interrupts or TWI.

We are using nrfx drivers for gpiote, twi and so on.

The way we are passing the gpios to the corresponding functions is :

NRF_GPIO_PIN_MAP(1, 3)
When application crashes, the ret code 8 is returned. Looking up in nrfx_errors.h it means "NRFX_ERROR_FORBIDDEN".
on one of the boards we have TWI assigned like this:
/*TWI0*/  {.sda_pin = NRF_GPIO_PIN_MAP(1, 2), .scl_pin = NRF_GPIO_PIN_MAP(1, 7)},
/*TWI1*/  {.sda_pin = NRF_GPIO_PIN_MAP(0, 25), .scl_pin = NRF_GPIO_PIN_MAP(1, 5)},


When attempting a TWI transaction, MCU reboots with RESETREAS 0x0000000c
When trying to configure an interrupt ret code 8 is also returned:
    ret_code_t err = nrfx_gpiote_in_init(NRF_GPIO_PIN_MAP(1, 6), &pin_in_cfg, pin_int_handler);
    ASSERT(err);
At the same time these problems are intermitent which worries me a lot.
What is the proper way of configuring P1.xx gpios with nrfx drivers ?

Parents
  • Hi,

    I think your lookup of the error code is wrong. The error code is 8, which is NRF_ERROR_INVALID_STATE, in comparison NRFX_ERROR_FORBIDDEN would be 0x0BAD0008. It should be possible to look at the implementation of the twi() call to find the reason for this error. I think you should check that the parameters passed to the twi() api, e.g. the twi instance, is static and global.

    You migt also build your project with DEBUG, such that you can find the exact error code, file name and line number of the assert in app_error_fault_handler() during development, if not the fault handler will simply execute NVIC_SystemReset() to recover (which is a good idea for an end product to safely recover, but not during development to identify errors).

    Kenneth

Reply
  • Hi,

    I think your lookup of the error code is wrong. The error code is 8, which is NRF_ERROR_INVALID_STATE, in comparison NRFX_ERROR_FORBIDDEN would be 0x0BAD0008. It should be possible to look at the implementation of the twi() call to find the reason for this error. I think you should check that the parameters passed to the twi() api, e.g. the twi instance, is static and global.

    You migt also build your project with DEBUG, such that you can find the exact error code, file name and line number of the assert in app_error_fault_handler() during development, if not the fault handler will simply execute NVIC_SystemReset() to recover (which is a good idea for an end product to safely recover, but not during development to identify errors).

    Kenneth

Children
Related