Hi,
i'm using SDK11 with NRF52832
After a pin falls from HIGH to LOW The GPIOTE_IRQHandler calls a function in my program to read 8 bits from the bus (Inside the interrupt !!!)
If the the LOW time is more then 10uS, --> everthing works great !! but if the LOW time is arround 6us then the
" while (nrf_gpiote_event_is_set(event_g)==0); " missies the interrupt !!!!
Any idea why???
B.r Yuval.
these are the relevant functions :
byte OW_read_byte_2 (void) // Called from GPIOTE_IQRHandler
{
unsigned char i;
byte result=0;
for (i=0;i<8;i++)
{
nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_IN_0);
if (OW_read_bit()) result |= 0x80; // if result is one, then set MS-bit
if (i < 7)
{
result >>= 1; // shift the result to get it ready for the next bit to receive
while (nrf_gpiote_event_is_set(event_g)==0);
}
}
if(ow_error) return 0;
return result;
}
void dallas_init(void)
{
uint32_t err_code;
nrf_drv_gpiote_in_event_disable(5);
err_code = nrf_drv_gpiote_init();
APP_ERROR_CHECK(err_code);
nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_HITOLO(true);
in_config.pull = NRF_GPIO_PIN_NOPULL;
err_code = nrf_drv_gpiote_in_init(5, &in_config, dallas_handler); // DALLAS RX
APP_ERROR_CHECK(err_code);
event_address_gpio_dallas = nrf_drv_gpiote_in_event_addr_get(5);
nrf_drv_gpiote_in_event_enable(5, true); // will be enable in logic
}