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

Why pin logic on NRF52-DK is interchanged?

Hi, I develop application on MBED platform with NRF52-DK. I figure out that pin "logic" on this board is interchanged. For example. I have LED connected to some pin. When I set this pin high (set 1) then LED light off and setting this pin low (zero) switch on the LED. Why? How to change such strange situation? Is it bug or standard (intentional) design for this MCU?

  • The same problem with PWM. Duty cycle (high state of the pin) means "duty-off" cycle. Funny, especially when someone (me:) has ready to run modules developed in different logic.

  • Solved. Only standard (green) LED on that board has "strange" logic. GPIO works OK. I must use my own (separate) LED to develop PWM module.

  • Of course it's not a bug, nor does it have anything to do with the MCU nor the GPIO nor is it strange in any way at all nor is the logic on the pin 'interchanged'. Just look at the circuit diagram, the LEDs are connected to VDD via a resistor so pulling the GPIO low lights them. If you read the manual for the DK, which is only a few pages long it states

    The LEDs are active low, meaning that writing a logical zero ('0') to the output pin will illuminate the LED.
    

    Nothing to be 'solved' here.

  • You're right, this is not an error as it is written in the documentation. But from the point of view of the developer, who has ready to run programs (modules) that work on several other boards and after the migration to the NRF-DK "stops working" can be treated as "bug". Moreover, someone could design a microprocessor with such inverted logic and write in the documentation that it works that way. But migrating software to such an architecture would be difficult or impossible. I am not an electronics engineer and do not understand the reasons for such reversed logic. Is this a better solution (than "standard") where 1 means high and 0 means low? Strange, though not a bug :)

  • With active low LEDs you are sinking the current, this is generally more recommended than sourcing the current because of more ground pads than vdd pads. Regarding Duty cycle and PWM, you can switch the logic so that with 0 duty cycle the LED will turn off, e.g with the pwm library:

    pwm1_cfg.pin_polarity[1] = APP_PWM_POLARITY_ACTIVE_HIGH;
    
Related