Dino-Game

Joystick Setup Configuration 🎮

Before to do the configuration on STM32CubeMX take a look of all pin configurations in this table

1. Connecting Joystick Sensor to STM32 board

Joystick Pin STM32 Board Pin > Pin CubeMX Config Connection Diagram
VRx A5 > PC_0 Connecting STM32Board to Joystick
VRy A4 > PC_1
SW D2 > PA_10
GND GND pin of Board


2. Configure ADC1 with two channels

2.1 Add ADC1 to DMA

In this section we set the two ADC1 channels to DMA in this way:

2. GPIO Configuration

  1. Configure GPIO pin for joystick button:
    • Navigate to the GPIO Configuration tab.
    • Set the pin PA_10 as a GPIO input.
    • The final configuration look like that Configure PA_10 as GPIO Input

3. Clock Configuration

  1. Ensure that the ADC clock is configured correctly in the RCC settings:
    • Navigate to the RCC Configuration tab that is situated in “System Core”.
    • Set High Speed Clock HSE as “Crystal/Ceramic Resonator” RCC Configuration Tab
  2. Clock configuration Tab
    • Take a look on the schema and we need to modify:
    • In PLL Source MUX select HSE
    • In System Clock MUX select HSI and the last value in the HCLK(MHz) select the maximum value that the board support Clock Configuration

Now go back