2016-04-29 08:30 AM
I would change uart in CDC standalone example for STM3210E_EVAL by uart1 to uart2.
I changed the code in this mode:/* Definition for USARTx clock resources */
#define USARTx USART2
#define USARTx_CLK_ENABLE() __HAL_RCC_USART2_CLK_ENABLE();
#define DMAx_CLK_ENABLE() __HAL_RCC_DMA1_CLK_ENABLE()
#define USARTx_RX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define USARTx_TX_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE()
#define USARTx_FORCE_RESET() __HAL_RCC_USART2_FORCE_RESET()
#define USARTx_RELEASE_RESET() __HAL_RCC_USART2_RELEASE_RESET()
/* Definition for USARTx Pins */
#define USARTx_TX_PIN GPIO_PIN_2
#define USARTx_TX_GPIO_PORT GPIOA
#define USARTx_RX_PIN GPIO_PIN_3
#define USARTx_RX_GPIO_PORT GPIOA
/* Definition for USARTx's NVIC: used for receiving data over Rx pin */
#define USARTx_IRQn USART2_IRQn
#define USARTx_IRQHandler USART2_IRQHandler
/* Definition for USARTx's DMA: used for transmitting data over Tx pin */
#define USARTx_TX_DMA_STREAM DMA1_Channel4
#define USARTx_RX_DMA_STREAM DMA1_Channel5
/* Definition for USARTx's NVIC */
#define USARTx_DMA_TX_IRQn DMA1_Channel4_IRQn
#define USARTx_DMA_RX_IRQn DMA1_Channel5_IRQn
#define USARTx_DMA_TX_IRQHandler DMA1_Channel4_IRQHandler
#define USARTx_DMA_RX_IRQHandler DMA1_Channel5_IRQHandler
/* Definition for TIMx clock resources */
#define TIMx TIM3
#define TIMx_CLK_ENABLE __HAL_RCC_TIM3_CLK_ENABLE
#define TIMx_FORCE_RESET() __HAL_RCC_USART2_FORCE_RESET()
#define TIMx_RELEASE_RESET() __HAL_RCC_USART2_RELEASE_RESET()
/* Definition for TIMx's NVIC */
#define TIMx_IRQn TIM3_IRQn
#define TIMx_IRQHandler TIM3_IRQHandler
But don't work good.I can test the code directly on the boardSTM3210E_EVAL.
If I write on the form of the hyperterminal USART, on the usb form I view strings of characters. Although, when I write 2 identical characters in a row only one of them appears correttemente. As if I write from the USB form, the usart form is blank. Usb hypertermial form a lockout.
Tips, plesae?
2016-05-25 08:31 AM
Hi bruno.vincenzo,
You should change the DMA channel relevant to USART2. (see reference manual RM0008 -> Table Summary of DMA1 requests for each channel)#define USARTx_TX_DMA_STREAM DMA1_Channel4
#define USARTx_RX_DMA_STREAM DMA1_Channel5
should be changed by
#define USARTx_TX_DMA_STREAM DMA1_Channel7
#define USARTx_RX_DMA_STREAM DMA1_Channel6
-Hannibal-