I would like to know if the Portenta H7 supports reading the digital bits values from an entire port and possibly the syntax / port names to use.
In-depth explanation: I am trying to sample data from an AD7616 ADC as fast as I can and I am using the Portenta due to the high clock speed. Currently I can make it work with SPI but the ADC also supports reading an entire 16bits in parallel mode. However I found that performing 16 consequent DIGITALREAD instructions does not speed up the read by much. Apparently direct port manipulation is supposed to be faster so I am looking to do something like this:
MSB=PORTA;
LSB=PORTB;
Does anyone know if this is possible on H7 and where to find the proper port-to-pin mapping? I confess I find the STM32H747XI 252-pages datasheet quite intimidating...
Your question - I would break it down into two other questions:
a) are the GPIO input bits grouped into a 32bit wide register? - NO!
b) can I do "bit-banging" on GPIO inputs? - NO!
Each GPIO input pin is a bit in a different register. You can only read ONE input bit at a time.
There is not a way to read N bits at the same time.
You had to iterate over all the GPIO input read registers and collect the bits by yourself.
"bit-banging: The ARM instruction set has some (assembly code) instructions to manipulate a single bit. But this works only on a memory which supports also "bit manipulation".
Some MCUs have a "bing-bang" memory, many not. And I am sure: the MCU used in Portenta H7 does NOT have "bit-banging".
(and it would never work on GPIO pins, for the MCU used in Portenta H7).
So,
You had to read all inputs as One-Bit-At-A-Time. No way to read more then ONE bit at the same time. The same for Output: you can set just one bit at a time.
And: "Read-Modify-Write" for a single bit does NOT work, because: the input bit and the output bit are on different registers (it needs separate instructions to "read-modify-write").
I have attached here my "GPIO_user" files:
You can see: I had to use a loop in order to collect all the GPIO bit values into a single 32bit value (for later use).
And bit manipulation (later) needs your code with AND, OR, EXOR, NEG etc. with masks (no "bit-banging" available).
You will see also the "port-to-pin" mapping which is actually to address the port, e.g. GPIOE and select the pin, e.g. GPIO_PIN_10. This is related to the pin in datasheet, schematics, e.g. as PE10.
BTW:
from a 'real-time-perspective': you can never read several pins at the same time, you can never set several output pins - IN PARALLEL (at the same time)!
Every input pin and every output pin is handled separately. Even just "mirroring" (copy) an input to an output pin needs N instructions (because they are on different registers and even on different register bits).