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

GPIOTE can toggle led but cannot set boolean

board: nRF52 DK

[update - fixed this - see #2]

When I use the following (shortened) code, the LED blinks when I press button 2 but I see no logs. NRF_LOG_INFO() is working in other areas of the code.

It doesn't make sense to me that nrf_drv_gpiote_out_toggle(LED1) gets called but foo does not get set to true.

[#2]

For an extra challenge, when I add the following function call to main (setup pins: sck=2, dout=26), LED1 turns on but pressing button 2 does not actuate the led anymore.

For this problem, I suspect it has something to do with GPIOTE channels, but I can't watch the registers because my vscode cortex debugger is not working right now. I'm not overlapping  any pins I believe.

Parents
  • Hi,

    Try setting the bool like this:



    More info
    on this.

    Can also be the the interrupt is firing to fast.



    For #2 check that the DK is not using these pins for something else.

Reply
  • Hi,

    Try setting the bool like this:



    More info
    on this.

    Can also be the the interrupt is firing to fast.



    For #2 check that the DK is not using these pins for something else.

Children
  • bool foo = false worked fine. The problem was something dumb.

    Since the problem only occurs when hx711_init() is called, I just made sure the hx711 pins don't overlap. I do not think this is the source of the problem