This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Monitor PIN change

I am new to NRF52832. I want to monitor continuously PIN 3 where I have connected USB to check whether my USB is connected or not. How can I do that. Please reply ASAP.

Parents
  • Hi..Amit

    first define PIN 3 and After that ,create timer instance for repeated mode and start it.

    then initalize , configure nrf_drv_gpiote_init driver based on ur configuration and enable input event on it.

    for more information u can look at example pin_change_int in SDK example folder.

    Regards.

  • Yes I have enabled GPIOTE in the nrf_drv_config file.

    Using in_config.sense or in_config1.sense does not make any difference in the output. But as per your suggestion I had changed the in_config1.sense to in_config.sense

    Just for information, I want to glow LED 17 when logic 1(Vcc) is given to PIN 3 and want to glow LED 18 when logic 0 (Gnd) is given to PIN 3. My issue is either logic 1 or logic 0 is given in PIN 3 the control always move to in_pin_handler function. So how can I know whether the input PIN 3 is logic 1 or logic 0 as in both the case of pin change control is going to in_pin_handler function.

Reply
  • Yes I have enabled GPIOTE in the nrf_drv_config file.

    Using in_config.sense or in_config1.sense does not make any difference in the output. But as per your suggestion I had changed the in_config1.sense to in_config.sense

    Just for information, I want to glow LED 17 when logic 1(Vcc) is given to PIN 3 and want to glow LED 18 when logic 0 (Gnd) is given to PIN 3. My issue is either logic 1 or logic 0 is given in PIN 3 the control always move to in_pin_handler function. So how can I know whether the input PIN 3 is logic 1 or logic 0 as in both the case of pin change control is going to in_pin_handler function.

Children
No Data
Related