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

P0.17 on nRF52840

Hi,

I designed a customer board and defined my own board header file, which is pretty much copied from pca10056.h. One question I encountered is I somehow couldn't toggle p0.17. 

int main(void)
{
    /* Configure board. */
    nrf_gpio_cfg_output(17);

    /* Toggle LEDs. */
    while (true)
    {
            nrf_gpio_pin_toggle(17);
            nrf_delay_ms(2000);
    }
}

I tried something like this, but it doesn't toggle. It always stays low. I'm sure this is some software config I need to change, but couldn't find it. Can someone point me the right direction?

Thanks,

Parents
  • I suggest you enter debug mode and verify that the PORT0's PIN_CNF[17] registers is set correctly after you've called nrf_gpio_cfg_output(17), and that PORT0's OUT register shows a toggling pin. Do note that you will need to halt the cpu in order to read the registers, so set a breakpoint after the configuration and after each toggling of the pin. 
     
    If you can verify that the registers behave as we expect then we're most likely looking at a soldering or ESD issue. A scope of the pin when it's toggling can be useful. 

Reply
  • I suggest you enter debug mode and verify that the PORT0's PIN_CNF[17] registers is set correctly after you've called nrf_gpio_cfg_output(17), and that PORT0's OUT register shows a toggling pin. Do note that you will need to halt the cpu in order to read the registers, so set a breakpoint after the configuration and after each toggling of the pin. 
     
    If you can verify that the registers behave as we expect then we're most likely looking at a soldering or ESD issue. A scope of the pin when it's toggling can be useful. 

Children
Related