We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I'm trying to use dma with uart in stm32f746 nucleo in receiving mode i can receive correct data in first use when i try to receive again receiving buffer doesn't change its initial values before receiving although i can get receive complete signal callback every time
/ Main Loop */ while(1) { HAL_GPIO_TogglePin(LED_PORT,LED_GREEN); // Led Example HAL_Delay(200); pRxData[0]=5; pRxData[1]=0; // HAL_UART_Receive_IT(&UartHandle,pRxData,2); if( HAL_UART_Receive_DMA(&UartHandle,pRxData,2)==HAL_OK); // UART-DMA-IT Example { while (UartReady != SET) // wait for msg len { HAL_GPIO_WritePin(LED_PORT,LED_GREEN,1); HAL_Delay(20); HAL_GPIO_WritePin(LED_PORT,LED_GREEN,0); HAL_Delay(400); } UartReady = RESET; // reset transmition flag LEN = pRxData[0]+pRxData[1]*256; // calc msg length if ( LEN > 0 ) { pTxData[0]= 25;//LEN; // ACK //HAL_UART_Transmit_IT(&UartHandle,pTxData,1); if(HAL_UART_Transmit_DMA(&UartHandle,pTxData,1)==HAL_OK); { while (UartReady != SET) { HAL_Delay(1); } UartReady = RESET; if(HAL_UART_Receive_IT(&UartHandle,pRxData,LEN)==HAL_OK) { //HAL_UART_Receive_DMA(&UartHandle,pRxData,LEN); while (UartReady != SET) // waiting loop for msg { HAL_GPIO_WritePin(LED_PORT,LED_GREEN,1); HAL_Delay(300); HAL_GPIO_WritePin(LED_PORT,LED_GREEN,0); HAL_Delay(50); } UartReady = RESET; if (MBU_StrCompareNC(pRxData,"LED_ON_BLUE",LEN)==0) { HAL_GPIO_WritePin(LED_PORT,LED_BLUE,1); } if (MBU_StrCompareNC(pRxData,"LED_OFF_BLUE",LEN)==0) { HAL_GPIO_WritePin(LED_PORT,LED_BLUE,0); } if (MBU_StrCompareNC(pRxData,"LED_ON_RED",LEN)==0) { HAL_GPIO_WritePin(LED_PORT,LED_RED,1); } if (MBU_StrCompareNC(pRxData,"LED_OFF_RED",LEN)==0) { HAL_GPIO_WritePin(LED_PORT,LED_RED,0); } } HAL_UART_Abort(&UartHandle); } } } } }
I'd say you run into a "cache problem". Try disabling caches and run again. It will lilkey work.
thanks very very very much it is right after disable D cache it works
please explain what problem with cache and how to use cache it self
I could, but really recommend to google for cache and DMA.
Hello sir, I have same problem but i do not understand to fix it, although the key problem is "disable D cache". can you explain it?
thanks you very very very must if you support ?