Author Topic: GPIO port on fly selection mechanism  (Read 2635 times)

0 Members and 1 Guest are viewing this topic.

Offline aseokTopic starter

  • Contributor
  • Posts: 35
  • Country: de
GPIO port on fly selection mechanism
« on: June 05, 2015, 07:44:23 am »
Hello
If i want to connect output of an ADC(analog to digital converter) to two different ports, e.g. GPIOA and GPIOB, and to modify this selection by means of software code(no hardware modification needed), how is it possible?
Is it adequate to connect ADC output to all of the intended pins and choose desired channel by modification of GPIO pins mode(input/output)?
Thanks.
 
 

Offline SL4P

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
  • There's more value if you figure it out yourself!
Re: GPIO port on fly selection mechanism
« Reply #1 on: June 05, 2015, 11:55:20 am »
I'm just watching - but fascinated to know why you'd want to do this...?
Perhaps I'm not reading the requirement properly - an external ADC - wired to two (or more) separate input pins...
I might learn something here!
Don't ask a question if you aren't willing to listen to the answer.
 

Online Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: GPIO port on fly selection mechanism
« Reply #2 on: June 05, 2015, 12:23:44 pm »
For analog mode, interleaving two ADC's to increase sample rate perhaps?
You might get away with it if the signal is actively driven, with an opamp for example, and you make sure you never enable the output drivers on any of the selected gpio. You pobably want to add current limiting resistors to prevent overloading the opamp/gpio if this happens accidentally. I wouldn't do this with an unbuffered high impedance input.

You can kill your chip if you connect two GPIO's set to ouput the opposite of eachother.
 

Offline aseokTopic starter

  • Contributor
  • Posts: 35
  • Country: de
Re: GPIO port on fly selection mechanism
« Reply #3 on: June 05, 2015, 01:57:28 pm »
Quote
To clarify, are you saying you want to connect the digital output of the ADC to two GPIOs at the same time, and select one in software?
Yes, it's right.
Quote
In that case, normally you just make one a floating input and use the other one as you normally would. In the code you can use pointers and bit masks to select the correct GPIO.
Thanks for your answer, i was wondering whether this is a solution or not, now my concern is at MCU startup and before GPIO ports initialization, Isn't there any connected ports current source or sink issue to be worry about before ports initialization?
Quote
I'm just watching - but fascinated to know why you'd want to do this...?
Perhaps I'm not reading the requirement properly - an external ADC - wired to two (or more) separate input pins...
I might learn something here!
I'm working on an ARM cortex-m4 based microcontroller project, i try to optimize output sample rate of the ADC so i decide to use different ports to achieve this purpose.
 

Offline mikerj

  • Super Contributor
  • ***
  • Posts: 3240
  • Country: gb
Re: GPIO port on fly selection mechanism
« Reply #4 on: June 05, 2015, 04:21:33 pm »
Thanks for your answer, i was wondering whether this is a solution or not, now my concern is at MCU startup and before GPIO ports initialization, Isn't there any connected ports current source or sink issue to be worry about before ports initialization?

When microcontrollers are reset it's usual for the digital ports to be automatically tri-stated (i.e. high impedance), in which case it is safe to connect them together.  Obviously you should check the datasheet for the device you are using to make sure this is the case.
 

Online Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: GPIO port on fly selection mechanism
« Reply #5 on: June 05, 2015, 04:24:11 pm »
Oh. I missed that you wanted to connect the digital end of adc |O
Anyway. How do you think using two gpio's is going to increase speed?
Normally, all gpio is equally clocked. Sometimes even slower than the chip.

The last line of my previous post is still valid.
 

Offline aseokTopic starter

  • Contributor
  • Posts: 35
  • Country: de
Re: GPIO port on fly selection mechanism
« Reply #6 on: June 05, 2015, 06:10:58 pm »
Quote
Anyway. How do you think using two gpio's is going to increase speed?
Normally, all gpio is equally clocked. Sometimes even slower than the chip
Ports aren't active simultaneously, increasing speed is possible by means of using some peripherals and a bit modification in their usage.

 

Online mikeselectricstuff

  • Super Contributor
  • ***
  • Posts: 13748
  • Country: gb
    • Mike's Electric Stuff
Re: GPIO port on fly selection mechanism
« Reply #7 on: June 06, 2015, 10:21:42 am »
It might help if you told us what MCU you are using.
Youtube channel:Taking wierd stuff apart. Very apart.
Mike's Electric Stuff: High voltage, vintage electronics etc.
Day Job: Mostly LEDs
 

Online Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: GPIO port on fly selection mechanism
« Reply #8 on: June 06, 2015, 11:41:48 am »
I still have to encounter a dual-edge AHB with an cortex m4. But I've not seen everything yet.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf