cancel
Showing results for 
Search instead for 
Did you mean: 

Using GPIO port as both input & output

HDesa.1
Senior

Hello,

I have designed a hardware using STM32H7 series to drive a 8-bits parallel memory. The memory has an I/O port using which data can be written into the memory and can be read from the memory.

How can I initialize the GPIO port in such a way that I can use them in both configurations i.e. to write the data into the memory and to read data from the memory.

Please advise.

 

- Regards

Hrishikesh

-Regards
Hrishikesh
7 REPLIES 7
gbm
Lead III

Set the port lines as outputs in the procedure writing data to memory, then set them as inputs right after the data is written.

While @gbm 's post above replies your question, you might want to use FMC/FSMC instead of manually-controlled signals.

JW

Thank you for the suggestion.

Could you please confirm my understanding?

As per your suggestion, you told that I will have to initialize the GPIO mode each time before I use the port for operation. So, when I am writing to the memory, I will set the GPIO mode as output(i.e. initialize the GPIO to output using HAL driver) and then write to the port, and when I am reading from the memory, I will set the GPIO mode as input(i.e. initialize the GPIO to input using HAL driver) and then read from the port,

Am I right?

-Regards

-Regards
Hrishikesh

I am sorry but I am not much sound with the FMC option of microcontroller. Could you please share some insights related to it?

-Regards

-Regards
Hrishikesh
LCE
Principal

Read the datasheet (short description of capabilities) and the reference manual. There is for sure some "presentation" about the FMC.
Look also for examples, software and hardware (discovery and other boards, there's usually no external memory on the Nucleos).

Also check the OCTOSPI peripheral.

Manually controlled IOs for memory don't make sense on a machine like the H7, unless you have some "very special" memory which you can't connect otherwise. And you should think about your choice of memory... 😉

So the memory which I am using has only parallel I/O interface (MT29F2G08). Also as per the datasheet the IC doesn't support OctoSPI.

But for this IC will FMC create a difference.

-Regards

-Regards
Hrishikesh
LCE
Principal

Just looked over the DS quickly, to me it looks like an "octal SPI" flash, which should be compatible with the OCTOSPI peripheral. But better ask some ST guys...

PS: it would help from the beginning to mention that it's about "flash" memory

PS2: googling ""MT29F" STM32h7 octospi" gave me at least one match...