GPIO port on fly selection mechanism - Page 1
Forum section: electronics / general

author: aseok
author_rank: Contributor
timestamp: June 05, 2015, 07:44:23 am
content: HelloIf 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.

author: SL4P
author_rank: Super Contributor
timestamp: June 05, 2015, 11:55:20 am
content: 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!

author: Jeroen3
author_rank: Super Contributor
timestamp: June 05, 2015, 12:23:44 pm
content: 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.

author: aseok
author_rank: Contributor
timestamp: June 05, 2015, 01:57:28 pm
content: QuoteYes, it's right.QuoteThanks 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?QuoteI'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.

author: mikerj
author_rank: Super Contributor
timestamp: June 05, 2015, 04:21:33 pm
content: Quote from: aseok on June 05, 2015, 01:57:28 pmWhen 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.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 05, 2015, 04:24:11 pm
content: Oh. I missed that you wanted to connect the digital end of adcAnyway. 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.

author: aseok
author_rank: Contributor
timestamp: June 05, 2015, 06:10:58 pm
content: QuotePorts aren't active simultaneously, increasing speed is possible by means of using some peripherals and a bit modification in their usage.

author: mikeselectricstuff
author_rank: Super Contributor
timestamp: June 06, 2015, 10:21:42 am
content: It might help if you told us what MCU you are using.

author: Jeroen3
author_rank: Super Contributor
timestamp: June 06, 2015, 11:41:48 am
content: I still have to encounter a dual-edge AHB with an cortex m4. But I've not seen everything yet.