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

nRF52810 hardware General IO output mode working unusual

Hi,

   I have layout a borad with nRF52810 and use IO to control other ICs.IOs map as blow.

#define LSM_6DS_SPI_CLK_PIN  9 /**< SPI */
#define LSM_6DS_SPI_CS_PIN    4
#define LSM_6DS_SPI_MI_PIN     5
#define LSM_6DS_SPI_MO_PIN   6

#define LED_2_PIN            18
#define LED_3_PIN            20
#define EN_MOVE_PIN     25
#define EN_SHAKE_PIN   10

#define CTRL1_PIN   12 //Red
#define CTRL2_PIN   14 //Black

  My software frame:

/************************/

main()

{

  platform_gpio_initialize();

 softdevice_init();

  while(1)

    {

         mycode();

     }

}

/************************/

Here is the platform_gpio_initialize() code

void platform_gpio_initialize()
{    
    /** @brief initialize sensor PIN  */

    nrf_gpio_cfg_output(LSM_6DS_SPI_CS_PIN);
    nrf_gpio_cfg_output(LSM_6DS_SPI_MO_PIN);
    nrf_gpio_cfg_output(LSM_6DS_SPI_CLK_PIN);
    nrf_gpio_cfg_input(LSM_6DS_SPI_MI_PIN, NRF_GPIO_PIN_PULLUP);
    
    nrf_gpio_pin_set(LSM_6DS_SPI_CS_PIN);
    nrf_gpio_pin_set(LSM_6DS_SPI_CLK_PIN);
    nrf_gpio_pin_clear(LSM_6DS_SPI_MO_PIN);		

	/** @brief initialize spi flash PIN */

    /** @brief initialize led pin */
	nrf_gpio_cfg_output(LED_2_PIN);
	nrf_gpio_pin_set(LED_2_PIN);
	nrf_gpio_cfg_output(LED_3_PIN);
	nrf_gpio_pin_set(LED_3_PIN);
	
	nrf_gpio_cfg_output(EN_MOVE_PIN);
	nrf_gpio_pin_clear(EN_MOVE_PIN);
	nrf_gpio_cfg_output(EN_SHAKE_PIN);
	nrf_gpio_pin_clear(EN_SHAKE_PIN);
	
	nrf_gpio_cfg_output(CTRL1_PIN);
	nrf_gpio_pin_clear(CTRL1_PIN);
	nrf_gpio_cfg_output(CTRL2_PIN);
	nrf_gpio_pin_clear(CTRL2_PIN);
	
	
	nrf_delay_ms(20);
	for(int i=0;i<7;i++)
	{
		nrf_gpio_pin_set(EN_MOVE_PIN);
		nrf_delay_ms(20);
		nrf_gpio_pin_clear(EN_MOVE_PIN);
		nrf_delay_us(20);
	}
	nrf_gpio_pin_set(EN_MOVE_PIN);
		
    
}

After download this code,the bluetooth advertising and  connection are working normally.

LED_2_PIN   LED_3_PIN     EN_SHAKE_PIN    cotrolling  are working normally, but the voltage of  CTRL2_PIN is always high (Voltage=1.6V)although I had clear this PIN in platform_gpio_initialize().But if I add  nrf_gpio_pin_clear(CTRL2_PIN) in main while(1), the voltage of CTRL2_PIN  is 0V.

So I don't  know where  is changing the CTRL2_PIN  VOLTAGE.

Parents
  • Hi,

    Is the below the only relevant code related to CTRL1_PIN and CTRL2_PIN, or is there some other parts of your code that you do not show here?

    #define CTRL1_PIN   12 //Red
    #define CTRL2_PIN   14 //Black
    ...
    	nrf_gpio_cfg_output(CTRL1_PIN);
    	nrf_gpio_pin_clear(CTRL1_PIN);
    	nrf_gpio_cfg_output(CTRL2_PIN);
    	nrf_gpio_pin_clear(CTRL2_PIN);

    If the above is the only one, then I do not see any explanation from SW but it would be good to double check. Could it be that you set/clear the pins from somewhere else? If not, then we need to look at your HW.

Reply
  • Hi,

    Is the below the only relevant code related to CTRL1_PIN and CTRL2_PIN, or is there some other parts of your code that you do not show here?

    #define CTRL1_PIN   12 //Red
    #define CTRL2_PIN   14 //Black
    ...
    	nrf_gpio_cfg_output(CTRL1_PIN);
    	nrf_gpio_pin_clear(CTRL1_PIN);
    	nrf_gpio_cfg_output(CTRL2_PIN);
    	nrf_gpio_pin_clear(CTRL2_PIN);

    If the above is the only one, then I do not see any explanation from SW but it would be good to double check. Could it be that you set/clear the pins from somewhere else? If not, then we need to look at your HW.

Children
Related