Author Topic: Analog Switch Control with STM32F7  (Read 1798 times)

0 Members and 1 Guest are viewing this topic.

Offline A.ErsozTopic starter

  • Regular Contributor
  • *
  • Posts: 75
  • Country: us
Analog Switch Control with STM32F7
« on: November 20, 2018, 08:17:07 pm »
Hello guys,

A normally open and a normally closed switches were connected to one of the pin of the STM32F767ZI. So, my aim is that when the NO switch is closed, NC switch should be open. Do you have any idea to control them with one output of the microprocessor?

Thanks
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1916
  • Country: se
Re: Analog Switch Control with STM32F7
« Reply #1 on: November 20, 2018, 08:45:46 pm »
If this analogue switch is controlled simply via the level of GPIO pins, it is possible to set and reset atomically and simultaneously (with a single write) any combination of pins via the use of the GPIOx_BSRR (Bit Set and Reset Register).

If only one pin is available, and you need opposite logic level, a single inverter gate  should suffice; they also come in single packages, if none is left over form other logic.

If the analogue switch is driven in some other other way, then please describe it.  :-// Is it still the HV2901?

Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 11291
  • Country: fi
Re: Analog Switch Control with STM32F7
« Reply #2 on: November 20, 2018, 09:09:20 pm »
Microcontroller is designed exactly to do that: control the IO the way you need. For example, if you need a deadtime for break-before-make operation, just turn the GPIO bits on/off in your desired order, with a small delay inbetween. But for this to be easy and straightforward, you need separate IOs.

Is it really possible you are out of IO on such a large device, and need to save one pin by combining the control of two switches to one IO?

We need more info.
 

Offline newbrain

  • Super Contributor
  • ***
  • Posts: 1916
  • Country: se
Re: Analog Switch Control with STM32F7
« Reply #3 on: November 20, 2018, 09:54:17 pm »
Nandemo wa shiranai wa yo, shitteru koto dake.
 

Offline A.ErsozTopic starter

  • Regular Contributor
  • *
  • Posts: 75
  • Country: us
Re: Analog Switch Control with STM32F7
« Reply #4 on: November 20, 2018, 11:41:24 pm »
Quote
If this analogue switch is controlled simply via the level of GPIO pins, it is possible to set and reset atomically and simultaneously (with a single write) any combination of pins via the use of the GPIOx_BSRR (Bit Set and Reset Register).

I get result with using this register. Thank you newbrain!

I just write code
Code: [Select]
HAL_GPIO_WritePin(SW_1_GPIO_Port, SW_1_Pin, GPIO_PIN_SET);.

Quote
Is it still the HV2901?

I changed in to PS393ESE one. Now, everything is clear and easy. But at the same time I am looking for another analog switch IC consisting more than four switches and smaller package.

Quote
Is it really possible you are out of IO on such a large device, and need to save one pin by combining the control of two switches to one IO?


Actually, the advantage is in the circuit that the switches default conditions are reverse. So, just one pin setting triggers activating one of them and closing the other one.

Thank you guys!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

-->