We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Is it possible using the ARM9 to configure a pin as both input and output? I need to be able to write to it and then read from it. This would be done as an open collector configuration. I have tried changing the DDR and the GPIOOUTPUT registers on the fly, but this did not work.
Thanks, Joe
You forgot to mention what processor you have, but the datasheet will tell you if there is any open-collector option for the output. It is more common that the GPIO pins just has the options to be an output, and input will pull-up, and input with pull-down or a high-impedive input.
A number of ARM chips allows the true pin value to be read back even when the pin is set as an output. But to get a reading different from the driven output state would then require the external equipment to fight a normally rather strong output pin.
Simulating an open-collector output by setting the output as constantly low and then dynamically reconfigure the data direction should most probably be possible, and something I have done on a number of ARM7 chips using either internal or external pull-up.
I haven't done it with ARM but I know it is doable with PIC: output digital 1 to charge up a capacitor, and then switching to analog input on the same pin to adc the voltage decay.
I would imagine it is the same for ARM. your problem might be latency: maybe you wait a little bit longer before you read it back?