2016-06-12 05:06 PM
Very new to STM32 development and am not an engineer, so apologies for what is likely a very silly question.
I'm attempting to use an STM32F103 as a programmable replacement for a game cartridge ROM. When switching from read I want to disconnect from the data bus. So I have my data port setup asGPIO_Mode_AF_PP as such:void
configure_gpio_data(
void
){
//GPIO structure used to initialize port
GPIO_InitTypeDef GPIO_InitStructure;
//Enable clock on APB2 pripheral bus
RCC_APB2PeriphClockCmd(DATACLK, ENABLE);
//Select pins to initialize
GPIO_InitStructure.GPIO_Pin = DATA;
//Select output mode
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
//Select speed
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
//Call initialization
GPIO_Init(DATAPORT, &GPIO_InitStructure);
}
And am attempting to switch with DATAPORT -> IDR and DATAPORT -> ODR. Where am I going wrong?
2016-06-12 07:26 PM
GPIO_Mode_IN_FLOATING
and GPIO_Mode_Out_PP Although it will likely be more efficient to switch modes from in/out via the peripheral registers.2016-06-12 08:41 PM
Thank you, Clive1.
I had a quick search for some example code of how to change the registry, but couldn't anything. Could you provide me with an example or reference?