cancel
Showing results for 
Search instead for 
Did you mean: 

Why doesn't this code match the GPIO Pin assignments for Uart in the book?

arm23
Associate II
Posted on March 01, 2008 at 14:42

Why doesn't this code match the GPIO Pin assignments for Uart in the book?

1 REPLY 1
arm23
Associate II
Posted on May 17, 2011 at 09:50

Hi,

Could somebody please explain this to me:

The following code is working and enables the GPIO pins for UART zero, first com port, on an MCB str9.

Looking at the table in the ATTACHED Hitex Insiders guide to the str9, page 114, the code targets pin 3.0 for UART0 Rx, which is fair enough, and makes sense. However what has me baffled is that the code, for UART0 TX, references pin 3.1, which makes absolutely no sense at all when you look at the table. When I change to code for what the table suggests, the program no longer works.

Could somebody please explain this and also how I would convert to uart1?

void GPIO_Configuration(void)

{

GPIO_InitTypeDef GPIO_InitStructure;

GPIO_DeInit(GPIO3);

/*Gonfigure UART0_Rx pin GPIO3.0*/

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;

GPIO_InitStructure.GPIO_IPConnected = GPIO_IPConnected_Enable;

GPIO_InitStructure.GPIO_Alternate = GPIO_InputAlt1 ;

GPIO_Init (GPIO3, &GPIO_InitStructure);

/*Gonfigure UART0_Tx pin GPIO3.1*/

GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;

GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;

GPIO_InitStructure.GPIO_Type = GPIO_Type_PushPull ;

GPIO_InitStructure.GPIO_Alternate = GPIO_OutputAlt2 ;

GPIO_Init (GPIO3, &GPIO_InitStructure);

}

Thanks,