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

turning off qdec led

In the nrf52 specification:

"The Phase A, Phase B, and LED signals are mapped to physical pins according to the configuration specified in the PSEL.A, PSEL.B, and PSEL.LED registers respectively. If the CONNECT field value 'Disconnected' is specified in any of these registers, the associated signal will not be connected to any physical pin."

There doesn't seem to be an obvious wrapper for this in the sdk. How do I access the PSEL.LED connect field to disable the LED?

Thank you

Parents
  • Note, if you are using the nrf_drv_qdec driver in SDK 12 (at least) you can NOT set the LED-pin to 0xFFFFFFFF! (you may do that for the psel.led register directly, but not when using the driver)

    This will in best case end up in an assert in nrf_gpio_pin_port_decode(), in worst case if assert is not enabled it will actually write to reg->PIN_CNF[0xFFFFFFFF] which is way out of range..

    This happens because nrf_drv_qdec_init calls:

    nrf_gpio_cfg_input(p_config->pselled, NRF_GPIO_PIN_NOPULL);
    
    ----> nrf_gpio_cfg(pin_number, ...)
    {
        NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number);
        reg->PIN_CNF[pin_number] = .... // pin_number = 0xFFFFFFFF
        


    See also: https://devzone.nordicsemi.com/f/nordic-q-a/37968/nrfx_qdec-driver-quirks

Reply
  • Note, if you are using the nrf_drv_qdec driver in SDK 12 (at least) you can NOT set the LED-pin to 0xFFFFFFFF! (you may do that for the psel.led register directly, but not when using the driver)

    This will in best case end up in an assert in nrf_gpio_pin_port_decode(), in worst case if assert is not enabled it will actually write to reg->PIN_CNF[0xFFFFFFFF] which is way out of range..

    This happens because nrf_drv_qdec_init calls:

    nrf_gpio_cfg_input(p_config->pselled, NRF_GPIO_PIN_NOPULL);
    
    ----> nrf_gpio_cfg(pin_number, ...)
    {
        NRF_GPIO_Type * reg = nrf_gpio_pin_port_decode(&pin_number);
        reg->PIN_CNF[pin_number] = .... // pin_number = 0xFFFFFFFF
        


    See also: https://devzone.nordicsemi.com/f/nordic-q-a/37968/nrfx_qdec-driver-quirks

Children
No Data
Related