cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Combo

Anonymous
Not applicable

Hi,

Im trying to build 1 wire communication through UART 2.

Protocol should have two modes as seen below.

1- Receiving Mode

2- Transmitting Mode

943362WCD4 will be opened in receiving mode so UART 2 is initilizated and tx pin is switched to input as seen below.

wiced_uart_init( WICED_UART_2, &uart_config, &rx_buffer );

wiced_gpio_init( WICED_GPIO_3, INPUT_HIGH_IMPEDANCE );

It works properly, all data is received smoothly. For transmitting mode WICED_GPIO_3 pin should be reconfigured to UART2.tx, is UART2 initilization necessary ?  Do you have any suggestion that switches WICED_GPIO_3 from  INPUT_HIGH_IMPEDANCE to WICED_UART_2.tx ?

BR

0 Likes
1 Solution
Anonymous
Not applicable
Take a look at inside platform_uart_init() in stm32f2xx_platform.c. I believe you can re-purpose the WICED_GPIO_3 back to UART by re-setting the GPIO to UART alternate function.

I copied the code pertaining to your question below. Hope that helps.

===========================================================================================

    /* Configure USART TX Pin */

    gpio_init_structure.GPIO_Pin   = (uint32_t) ( 1 << uart_mapping[uart].pin_tx->number );

    gpio_init_structure.GPIO_Mode  = GPIO_Mode_AF;

    gpio_init_structure.GPIO_OType = GPIO_OType_PP;

    gpio_init_structure.GPIO_PuPd  = GPIO_PuPd_NOPULL;

    gpio_init_structure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_Init( uart_mapping[uart].pin_tx->bank, &gpio_init_structure );

    GPIO_PinAFConfig( uart_mapping[uart].pin_tx->bank, uart_mapping[uart].pin_tx->number, uart_mapping[uart].gpio_af );

===========================================================================================

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable
Take a look at inside platform_uart_init() in stm32f2xx_platform.c. I believe you can re-purpose the WICED_GPIO_3 back to UART by re-setting the GPIO to UART alternate function.

I copied the code pertaining to your question below. Hope that helps.

===========================================================================================

    /* Configure USART TX Pin */

    gpio_init_structure.GPIO_Pin   = (uint32_t) ( 1 << uart_mapping[uart].pin_tx->number );

    gpio_init_structure.GPIO_Mode  = GPIO_Mode_AF;

    gpio_init_structure.GPIO_OType = GPIO_OType_PP;

    gpio_init_structure.GPIO_PuPd  = GPIO_PuPd_NOPULL;

    gpio_init_structure.GPIO_Speed = GPIO_Speed_50MHz;

    GPIO_Init( uart_mapping[uart].pin_tx->bank, &gpio_init_structure );

    GPIO_PinAFConfig( uart_mapping[uart].pin_tx->bank, uart_mapping[uart].pin_tx->number, uart_mapping[uart].gpio_af );

===========================================================================================

View solution in original post

0 Likes