does not work uart RX DMA after baudrate change from 9600 to 115200 during run mode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 7:15 PM
chip : stm32L433CCUX. source code is made by cubeMX automatically.
below my scenarios.
1.stm32l4 starts with uart baud rate 9600. and start with uart DMA.
2.communicate with other gps module by uart baud rate is 9600. for gps configuration
gps uart baud rate change is 115200.
3.stm32l4 uart baud rate is change 115200.
my problem is after uart baud rage changed with 115200. the uart DAM is not work.
i check the " the huart3.hdmarx->Instance->CNDTR" number.
if uart RX DMA is received data, huart3.hdmarx->Instance->CNDTR will be changed.
but no changed.
also, i set up circular mode with uart rx dma.
my code below
/* Initialize all configured peripherals */
// MX_GPIO_Init();
MX_DMA_Init();
MX_USART3_UART_Init(); // baud rate 9600
MX_I2C2_Init();
MX_USB_DEVICE_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
HAL_UART_Receive_DMA(&huart3,UART_Receive_data,sizeof(UART_Receive_data));
CLEAR_BIT(huart3.Instance->CR1, USART_CR1_PEIE);
CLEAR_BIT(huart3.Instance->CR3, USART_CR3_EIE);
void gpsConfiguration(void)
{
#if 1
for(int i=0;i<28;i++)
{
//HAL_UART_Transmit(&huart3,&BDrateHex115200[i],28,10);
HAL_UART_Transmit_DMA(&huart3,&BDrateHex115200[i],28);
}
HAL_Delay(1000);
huart3.Instance = USART3;
huart3.Init.BaudRate = 115200; //changed 115200
huart3.Init.WordLength = UART_WORDLENGTH_8B;
huart3.Init.StopBits = UART_STOPBITS_1;
huart3.Init.Parity = UART_PARITY_NONE;
huart3.Init.Mode = UART_MODE_TX_RX;
huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE;
huart3.Init.OverSampling = UART_OVERSAMPLING_16;
huart3.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE;
huart3.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT;
if (HAL_UART_Init(&huart3) != HAL_OK)
{
_Error_Handler(__FILE__, __LINE__);
}
#endif
}
- Labels:
-
STM32L4 series
-
UART-USART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 7:25 PM
Make sure you clear any underrun, framing or noise type errors that might be blocking the USART reception.
if (USART3->ISR & USART_ISR_ORE) // Overrun Error
USART3->ICR = USART_ICR_ORECF;
if (USART3->ISR & USART_ISR_NE) // Noise Error
USART3->ICR = USART_ICR_NCF;
if (USART3->ISR & USART_ISR_FE) // Framing Error
USART3->ICR = USART_ICR_FECF;
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 7:58 PM
hello thanks your comment.
can you explain more?
where these code is programmed ? what api?
i have to code in HAL_UART_RxCpltCallback??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 8:01 PM
these code are already in the UART_DMAReceiveCplt.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 8:09 PM
>>where these code is programmed ?
The obvious place would be after you've changed the baud rate in order to clear any errors that has induced.
>>these code are already in the UART_DMAReceiveCplt.
That's only going to help if it gets there, and you've already stated that it stopped working.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-14 9:14 PM
hello.
as a result, after change baud rate, i program these code.
but, still i have problem. uart rx dma is not worked.
can i check the overrun error, or noise error, framing error in debug mode?
how can i check these errors ?
thanks a lot
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-15 12:43 AM
What clock is the UART being driven from?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2018-12-15 8:36 AM
You'd want to inspect the registers in the DMA and USART to see what is happening with those. Double check the rate on the GPS has changed, and you can see signal at the right rate on the pins. Check with polled querying of the USART.
Up vote any posts that you find helpful, it shows what's working..
