2015-11-11 02:44 AM
Hello,
I am using STM32L053R6 interfaced to Blue NRG chip. I am accessing the blue NRG through VCOM. I have connected a USB to UART converter to a PC and was trasmitting the VCOM data over this. It worked!!! Now, I want to do the same in half duplex mode. I have designed a circuit for the USB to UART converter so that it acts as a single wire UART. It seems to work as I can see the data being sent to STM32. But however, there is no response from the controller. I doubt even if it is reading this data. Can you please check if my half duplex configuartion is right? GPIO_InitTypeDef GPIO_InitStruct; /*♯♯-1- Enable peripherals and GPIO Clocks ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯*/ /* Enable GPIO TX/RX clock */ USARTx_TX_GPIO_CLK_ENABLE(); USARTx_RX_GPIO_CLK_ENABLE(); /* Enable USART1 clock */ USARTx_CLK_ENABLE(); /*♯♯-2- Configure peripheral GPIO ♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯♯*/ /* UART TX GPIO pin configuration */ GPIO_InitStruct.Pin = USARTx_TX_PIN; GPIO_InitStruct.Mode = GPIO_MODE_AF_OD; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FAST; GPIO_InitStruct.Alternate = USARTx_TX_AF; HAL_GPIO_Init(USARTx_TX_GPIO_PORT, &GPIO_InitStruct); GPIO_InitStruct.Pin = USARTx_RX_PIN; GPIO_InitStruct.Alternate = USARTx_RX_AF; HAL_GPIO_Init(USARTx_RX_GPIO_PORT, &GPIO_InitStruct); And then, UartHandle.Instance = USARTx; UartHandle.Init.BaudRate = 9600; UartHandle.Init.WordLength = UART_WORDLENGTH_8B; UartHandle.Init.StopBits = UART_STOPBITS_1; UartHandle.Init.Parity = UART_PARITY_NONE; UartHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE; UartHandle.Init.Mode = UART_MODE_TX_RX; if(HAL_UART_Init(&UartHandle) != HAL_OK) { // Initialization Error Error_Handler(); } if(HAL_HalfDuplex_Init(&UartHandle) != HAL_OK) { Error_Handler(); } #nucleo #half-duplex-usart #bluenrg