STM32F303 Target - Buttons Via GPIO Pins

I’m looking to do some side-channel experiments that involve three physical buttons, each of which needs an independent pin. I’m planning to have them wired up with drop-down resistors and be connected to GPIO pins. However, I’ve been unable to find any example of using GPIO pins for a given platform. I plan to utilize the STM32F303RTC7 target board. Through this post I’ve found where the GPIO setup is done (chipwhisperer/software/chipwhisperer/capture/scopes/cwhardware/ChipWhispererExtra.py) and this post references examples, however I haven’t been able to track any such examples down. Any guidance would be greatly appreciated.

Do you want the buttons to affect the capture board, or the target? If it’s the target, you can find the STM32F3 specific code at hardware/victims/firmware/hal/stm32f3, with stm32f3_hal.c doing things like modifying GPIOs, peripherals, etc.

Alex

I’d like the buttons to affect the target board. Thank you for linking to that code, it will be very helpful to unwind all of this. After looking though it for a bit, I’m unsure which pins are actually available for GPIO use, more specifically, which pins the correspond to on the UFO board. I believe part of the issue is that I’m unsure if the GPIO pins labeled on the left-hand side of the UFO board are currently being used or not. Looking a little deeper, hardware/victims/firmware/hal/stm32f3/stm32f3xx_hal_gpio.h defines 16 GPIO pins, however, both the target board data sheet and the UFO board data sheet only have four GPIO pins.

PA9 and PA10 are usually used for UART, PA12 is usually used for a trigger pin, and PH0 is used as a clock pin. Other than that all the other pins should be available. Keep in mind that PA11, PB12-15 are connected to the ChipWhisperer (though normally unused), and PC13-15 are connected to LEDs, and PB3-4, and PA13-15 are JTAG pins (though you might be able to use those as GPIOs as well). All the other available pins are labelled on the board.

Alex