Using UARTE1 as event line

I am interfacing nRF to a GPRS modem. In order to ensure the modem is in a known state I do a power cycle of the modem and I determine completion by monitoring the TX line from the modem using the UARTE1 RX. When the modem powers down the modem TX line goes low, and when the modem completes it power up the modem TX line goes high ready to act as UART.

I would like to detect the change from low to high in the modem TX line as an event through the UARTE1 line before enabling as a uart.

I can monitor the change successfully by polling the UARTE1 RX line, but I am trying to make this as an event.

I have followed the example for the on board switch of the dongle, which functions.

I have as code

#define UARTE1_RX_PIN 17    /* (P0.17) */

#define POWER_ON_PIN    UARTE1_RX_PIN    /* (P0.17)*/

                        nrf_drv_gpiote_in_config_t in_config = NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false);
                        err_code = nrf_drv_gpiote_in_init(POWER_ON_PIN, &in_config, gprsTurnOnTxHighHandler);
                        APP_ERROR_CHECK(err_code);
                        nrf_drv_gpiote_in_event_enable(POWER_ON_PIN,true);

However I never see an interrupt

I am using SDK16.0

Parents Reply
  • I see. I do not immediately spot any issues in the code snippet you have here though, and it should work. You can refer to the pin change interrupt example in the SDK. That would be more or less equivalent with that you have here except that it triggers on both high and low and use GPIOTE (high accuracy, at the expense of current consumption). But if you change the configuration to the input pin from PIOTE_CONFIG_IN_SENSE_TOGGLE(false) to NRFX_GPIOTE_CONFIG_IN_SENSE_LOTOHI(false) the example still works and demonstrate what you need.

Children
Related