2017-04-23 09:35 PM
Hi , I have succesfuly managed to merge the GPIO example code into my project.
I am using the audio application project as the base project.
The GPIO button toggles the LED.
I would like to define 3 GPIO pins as digital ouputs on the arduino headers of the STM32F769I-discovery board
so far I have code below, but can't find the arduino pin : GPIO pin map ?
can arduino pins GPIO ? or should I be doing this a different way ? I just need to toggle 3 pins high and low.
static void EXTI0_GPIO_BEN(void)
{ GPIO_InitTypeDef GPIO_InitStructure;/* Enable GPIOC clock */
__HAL_RCC_GPIOA_CLK_ENABLE();// configure gpio pins for reset for external adc dsp and dac devices
// gpio reset for ADC
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ? GPIO_InitStructure.Pin = GPIO_PIN_0; // gpio reset for DSP GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ? GPIO_InitStructure.Pin = GPIO_PIN_1; // gpio reset for DAC GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_NOPULL; // no pullup or pull dowm resistors ? GPIO_InitStructure.Pin = GPIO_PIN_1;HAL_GPIO_Init(GPIOA, &GPIO_InitStructure); /// go initilize pins ?
// i don't think I need to have interrupts for this ??
/* Enable and set EXTI line 0 Interrupt to the lowest priority */
// HAL_NVIC_SetPriority(EXTI0_IRQn, 2, 0); // HAL_NVIC_EnableIRQ(EXTI0_IRQn);}2017-04-24 02:07 PM
PI8 is Pin 8 on Bank I
GPIO_PIN_8
ARD_D0 is a net name on the schematic, it connects to PC7 of the STM32
2017-04-25 02:29 AM
are there any other physical GPIO pins available as digital outputs on the STM32F769I-discovery ?
You would need to check the schematics for GPIOs that are routed to a header (CNxx), and are not hooked up (connected) to other periphery, like USB, LCD, etc.
what does PCx , PFx , PAx etc stand for ?
'P' stands for Port, and the next letter is just sequential numbering [A, B, C, ...].
Other vendors (NXP for instance) do count their port with numbers instead (P0, P1, ...).
And finally, the number is the bit number within the port.
So, PC7 is bit 7 of the third port.
2017-04-25 08:44 AM
Hi AvaTar , understanding the GPIO port A,B,C - J did it thanks so much !
ARD_D2, ARD_D4 & ARD_D7 are not shared with anything else and work. have'nt tried any others yet.
GPIO_InitTypeDef GPIO_InitStructure;
__HAL_RCC_GPIOC_CLK_ENABLE();
// gpio arduino pins
GPIO_InitStructure.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStructure.Pull = GPIO_PULLUP; // GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_0 | GPIO_PIN_3; // ARD_D2=PJ1 | ARD_D4=PJ0 | ARD_D7=PJ3 GPIO_InitStructure.Speed = GPIO_SPEED_FREQ_HIGH;HAL_GPIO_Init(GPIOJ, &GPIO_InitStructure); // initialise GPIO 'J' port !
HAL_GPIO_TogglePin(GPIOJ, GPIO_PIN_1); // ARD_D1 PJ1
HAL_GPIO_TogglePin(GPIOJ, GPIO_PIN_0); // ARD_D4 PJ0 HAL_GPIO_TogglePin(GPIOJ, GPIO_PIN_3); // ARD_D7 PJ3// HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_1, GPIO_PIN_SET); //GPIO_PIN_SET ( on ) GPIO_PIN_RESET ( off )
// HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_0, GPIO_PIN_SET); // HAL_GPIO_WritePin(GPIOJ, GPIO_PIN_3, GPIO_PIN_SET);