2021-01-10 02:09 PM
I'm planning on using a STM32F411CE in an application where the SDIO hard peripheral is connected to a SD-card in 4-bit mode. I also need to use both PA and PB ports in a rather high-speed fashion, so I'd like to set them one 16-bit word at a time (instead of bit-by-bit). If I write a word to say, PB, where bits 4, 5 & 15 are already allocated by the SDIO peripheral, will there be issues? Is there a way to mask off those 3 bits so I won't ruin the SD transfers?
If this specific question is mentioned in any manuals or other places, please point me there. I'm capable of RTFM, I just didn't know where to look. :)
Solved! Go to Solution.
2021-01-10 03:01 PM
GPIO chapter of RM and pin AF assignment table in Datasheet.
To have pins assigned to a peripheral, they have to be set as AF in GPIO_MODER. To output value from ODR a different setting, Out, is set in GPIO_MODER.
JW
2021-01-10 03:01 PM
GPIO chapter of RM and pin AF assignment table in Datasheet.
To have pins assigned to a peripheral, they have to be set as AF in GPIO_MODER. To output value from ODR a different setting, Out, is set in GPIO_MODER.
JW
2021-01-10 03:19 PM
Right, so that means, pins that are set as "AF" aren't affected by data written to the ODR. Excellent! That's one thing less to be concerned about. :) Then I can complete the PCB schematic with more confidence. Thanks!
2021-01-10 08:22 PM
Alternatively, writing to GPIOx->BSRR will let you set or reset only the pins you want without messing with the others.
2021-01-11 06:36 AM
The 'F412 DISCO board features a microSD connector https://www.st.com/en/evaluation-tools/32f412gdiscovery.html so may serve as a test vehicle for initial experiments.
JW
2021-01-11 07:35 AM
Excellent tip, thank you Jan!
Now I just have to manage my impulses to refrain from finishing the new PCB, in favour of testing the concept on a proven dev-board, just like a well-behaved engineer is supposed to. Hmm... :smirking_face: We'll see...
2021-01-11 12:50 PM
It's like a textbook: you read it (or maybe even skim through it) it once, when you buy it; then it gathers dust on the shelf until that one day whey you need to look up that particular thing...
JW
2021-01-13 06:20 AM
Besides datasheet and reference manual, the AN4899 gives additional details on GPIO. :)