currently, i connected the nrf52(spi master) with ads1292 (spi slave) which is a ECG sensor. For the ads1292 chips, there is a output pin generating the signal called DRDY to indicate the spi data is ready. just like the following picture shown, when the spi data is ready to send to master, DRDY become low and when the data start to be transmitted, DRDY become high. here I want to use DRDY as a interrupt signal. So i connect this output pin to P0.31 of nrf52 DK and configure p0.31 as a interrupt input pin. however, when i run the program, it will stuck in the interrupt configuration function(drdy_enable). if i comment out the (drdy_enable)function, it will continue to run. please help me check the interrupt function.
void drdy_enable(void){
nrf_gpio_cfg_input(31, GPIO_PIN_CNF_PULL_Pullup); //configure pin0.31 as gpio interrupt
NVIC_EnableIRQ(GPIOTE_IRQn);
NRF_GPIOTE->CONFIG[0] = (GPIOTE_CONFIG_POLARITY_HiToLo << GPIOTE_CONFIG_POLARITY_Pos)
| (31 << GPIOTE_CONFIG_PSEL_Pos)
| (GPIOTE_CONFIG_MODE_Event << GPIOTE_CONFIG_MODE_Pos);
NRF_GPIOTE->INTENSET = GPIOTE_INTENSET_IN0_Set << GPIOTE_INTENSET_IN0_Pos; }
void GPIOTE_IRQHandler1(void){
if ((NRF_GPIOTE->EVENTS_IN[0] == 1) && (NRF_GPIOTE->INTENSET & GPIOTE_INTENSET_IN0_Msk))
{
NRF_GPIOTE->EVENTS_IN[0] = 0;
}
DRDY = 1; }
in main function
{ // Setup bsp module.
bsp_configuration();
nrf_drv_spi_config_t const config =
{
#if (SPI0_ENABLED == 1)
.sck_pin = SPIM0_SCK_PIN,
.mosi_pin = SPIM0_MOSI_PIN,
.miso_pin = SPIM0_MISO_PIN,
.ss_pin = SPIM0_SS_PIN,
#elif (SPI1_ENABLED == 1)
.sck_pin = SPIM1_SCK_PIN,
.mosi_pin = SPIM1_MOSI_PIN,
.miso_pin = SPIM1_MISO_PIN,
.ss_pin = SPIM1_SS_PIN,
#elif (SPI2_ENABLED == 1)
.sck_pin = SPIM2_SCK_PIN,
.mosi_pin = SPIM2_MOSI_PIN,
.miso_pin = SPIM2_MISO_PIN,
.ss_pin = SPIM2_SS_PIN,
#endif
.irq_priority = APP_IRQ_PRIORITY_LOW,
.orc = 0xCC,
.frequency = NRF_DRV_SPI_FREQ_1M,
.mode = NRF_DRV_SPI_MODE_0,
.bit_order = NRF_DRV_SPI_BIT_ORDER_MSB_FIRST,
.ss_pin = NRF_DRV_SPI_PIN_NOT_USED,
};
ret_code_t err_code_spi = nrf_drv_spi_init(&m_spi_master, &config, spi_master_event_handler);
APP_ERROR_CHECK(err_code_spi);
drdy_enable();
GPIOTE_IRQHandler1();
ADS1292_init();
while (1)
{
if (DRDY)
{
DRDY = 0;
SPIStreamReadReg(); // send data to master
}
}
}