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

how to configure two gpio pin in High drivemode 5mA

Hello everyone,

I am trying to congifure two gpio pin (pin 6and 7) in standard high drive mode 5MA because am trying to connect those pin to the speaker inorder to increase the loudness by having 10mA at the input of the speaker so can anyone suggest some ideas or example how to configure tow gpio pin in high drive mode any suggestions or ideas would be really appreciated i found these information in the library files but i did not understand what does it meany by SOS1 which is softdevice version 1 or something else?

NRF_GPIO->PIN_CNF[pin_number] = (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos);

Do i ahve to configure like this ? or something else

NRF_GPIO->PIN_CNF[6] = (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos);

NRF_GPIO->PIN_CNF[7] = (GPIO_PIN_CNF_DRIVE_S0S1 << GPIO_PIN_CNF_DRIVE_Pos);

main.c

Thanks

Parents
  • Hi, I'm going to use VisualStudio with VisualGDB for programming my nRf51 project. I have two 2mA low-current LEDs I'd like to set high in high-drive mode.

    There's a simple sample code for blinking an LED:

    #include <stdbool.h>
    #include <stdint.h>
    
    #ifdef __cplusplus
    extern "C" {
    #endif
    	
    #include "nrf_delay.h"
    #include "nrf_gpio.h"
    	
    #ifdef __cplusplus
    }
    #endif
    
    
    int main(void)
    {
    	nrf_gpio_cfg_output(13);
    
    	for (;;)
    	{
    		nrf_gpio_pin_set(13);
    		nrf_delay_ms(500);
    		nrf_gpio_pin_clear(13);
    		nrf_delay_ms(500);
    	}
    }
    

    Now I would like to use this sample use pins 12 & 13 in high-drive mode. Is there any example available for this? On those pins I've connected low-current LEDs.

  • You can make your own function for configuring a gpio as output in high drive:

    __STATIC_INLINE void nrf_gpio_cfg_output_high_drive(uint32_t pin_number)
    {
        nrf_gpio_cfg(
            pin_number,
            NRF_GPIO_PIN_DIR_OUTPUT,
            NRF_GPIO_PIN_INPUT_DISCONNECT,
            NRF_GPIO_PIN_NOPULL,
            NRF_GPIO_PIN_H0H1,
            NRF_GPIO_PIN_NOSENSE);
    }
    
Reply Children
No Data
Related