Dear support team,
I would like to use GPIO 09/10 as a GPIO interrupt.
I just searched and I see that need to define CONFIG_NFCT_PINS_AS_GPIOS.
But I can't do it. Please help!
P/s: I use nrf52840 with segger embedded.
Thanks and regards,
John N
Dear support team,
I would like to use GPIO 09/10 as a GPIO interrupt.
I just searched and I see that need to define CONFIG_NFCT_PINS_AS_GPIOS.
But I can't do it. Please help!
P/s: I use nrf52840 with segger embedded.
Thanks and regards,
John N
Why can't you define CONFIG_NFCT_PINS_AS_GPIOS?
Nevertheless, if for some reason you cannot define CONFIG_NFCT_PINS_AS_GPIOS you can run the code it would trigger by yourself
// Making sure the NFC pins are set as GPIO
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk)
== (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos)) {
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
}
NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
}
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy) {
}
NVIC_SystemReset();
}I mean when I defined CONFIG_NFCT_PINS_AS_GPIOS, my code still doesn't work.
Can I put this code in main.c, before init gpio, right?
Thanks,
John N
Hi John,
How have you defined CONFIG_NFCT_PINS_AS_GPIOS?
You should add this to the preprocessor definitions in SEGGER Embedded Studio. You can do so by doing the following: Go to Project > Edit Options > Code > Preprocessor > Preprocessor Definitions and add CONFIG_NFCT_PINS_AS_GPIOS there.
Best regards,
Marte
Hi,
my application is config GPIO 10 as GPIO interrupt. I already defined CONFIG_NFCT_PINS_AS_GPIOS in Preprocessor Definitions as you refer.
This is my code. Could you help me check it?
P/S; macro FLOW_SS_PIN_INPUT is defined as GPIO 10static void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
test_adc = true;
flow_cnt ++;
FLOW_DBG(TAG, "cnt = %d\r\n", flow_cnt);
}
void flow_sensor_init(void)
{
ret_code_t err_code;
if ((NRF_UICR->NFCPINS & UICR_NFCPINS_PROTECT_Msk)== (UICR_NFCPINS_PROTECT_NFC << UICR_NFCPINS_PROTECT_Pos))
{
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
NRF_UICR->NFCPINS &= ~UICR_NFCPINS_PROTECT_Msk;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
NRF_NVMC->CONFIG = NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy);
NVIC_SystemReset();
}
//init gpioe
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
//init input
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
in_config.pull = NRF_GPIO_PIN_PULLUP;
err_code = nrf_drv_gpiote_in_init(FLOW_SS_PIN_INPUT, &in_config, in_pin_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_event_enable(FLOW_SS_PIN_INPUT, true);
}
Hi,
Thanks for your support.
I already defined in Preprocessor Definitions.
Could you check the code that I posted above? Hope that You can find out issue.
Thanks