Post Go back to editing

I want to set GPIO_Pin_0, GPIO_Pin_1 and GPIO_Pin_2 to output pin and set the value as high for AD5941 .But not able to.

Category: Software
Product Number: AD5940

Hi Folkes,

After running  AD5940_HWReset();
AD5940_Initialize(); functions and verifying the ADIID and chip-id of AD5940, I am trying to to  set GPIO_Pin_0, GPIO_Pin_1 and GPIO_Pin_2 to output pin and set the value as high for AD5941. 

I tried following code: 

	uint32_t j =   AD5940_ReadReg(REG_AGPIO_GP0OUT);
	uint32_t i = AD5940_ReadReg(REG_AGPIO_GP0IEN);
    uint32_t k = AD5940_ReadReg(REG_AGPIO_GP0OEN);
	AGPIOCfg_Type agpioCfg;

	/* Configure AGPIO Pin 0, Pin 1, and Pin 2 as output pins */
	agpioCfg.FuncSet = GP0_GPIO | GP1_GPIO | GP3_GPIO ;
	agpioCfg.OutputEnSet = AGPIO_Pin0|AGPIO_Pin1|AGPIO_Pin2;
	agpioCfg.InputEnSet = 0;
	agpioCfg.PullEnSet = AGPIO_Pin0|AGPIO_Pin1|AGPIO_Pin2;
	agpioCfg.OutVal = AGPIO_Pin0|AGPIO_Pin1|AGPIO_Pin2;
	AD5940_AGPIOCfg(&agpioCfg);


	//AD5940_AGPIOSet(AGPIO_Pin0 | AGPIO_Pin1 | AGPIO_Pin2);
	j =   AD5940_ReadReg(REG_AGPIO_GP0OUT);
	i = AD5940_ReadReg(REG_AGPIO_GP0SET);
	k = AD5940_ReadReg(REG_AGPIO_GP0OEN);
}

But not able to get the proper GPIO output level after running this code? 

Do I missing something? Do we require pull-up resistor to do this action? 

If there is change in code required then let me know? Or I am missing some configurations? I am using STM32WB55xx mcu  for the SPI communication. 

Parents Reply
  • I tried by removing Pin2 but still It did not work. As AD5940 have only thee pins, 

    AIN_Pin0, AIN_Pin1 and AIN_Pin2 there is no AIN_Pin3 in that. 

    So I tries following code: 

    agpioCfg.FuncSet = GP0_GPIO | GP1_GPIO ;
    agpioCfg.OutputEnSet = AGPIO_Pin0|AGPIO_Pin1;
    agpioCfg.InputEnSet = 0;
    agpioCfg.PullEnSet = AGPIO_Pin0|AGPIO_Pin1;
    agpioCfg.OutVal = AGPIO_Pin0|AGPIO_Pin;

    AD5940_AGPIOCfg(&agpioCfg);

    And I am not able to see the changes on the GPIO pin. 

Children