2020-07-28 02:26 AM
peripheral settings done properly.
STM32F401RE -- has settings DMA2 & GPIOA (PIN_10 & PIN_11).
STM32L431CC -- But i have configured -- DMA1 & GPIOB(PIN_10, PIN_11).
Data Transmission & Reception not happening.
any suggestions .
2020-07-28 05:00 AM
provide more info, code , register image captures , ...
2020-07-28 05:04 AM
2020-07-30 10:08 PM
hi prain,
please can you give some info on this.
2020-07-30 11:38 PM
why do you comment thease lines in main?
//while (__HAL_UART_EMUL_GET_FLAG(&UartEmulHandle, UART_EMUL_FLAG_TC) != SET)
//{}
It should be there to verify that transmit phase have been completed. without that usart and DMA settings will overwrited by next function.
Also in debug mode step into
HAL_UART_Emul_Transmit_DMA function and check that settings are properly written to DMA and GPIO.
read the below list and check that all steps are done:
The UART Emulation HAL driver can be used as follows:
(#) Declare a UART_Emul_HandleTypeDef handle structure.
(#) Initialize the UART Emulation low level resources by implementing the HAL_UART_Emul_MspInit() API:
(##) Enable the UART_EMUL clock
(##) UART Emulation port declaration
(+++) UART pins configuration: TxPinNumber and RxPinNumber
(+++) Enable the clock for the GPIOs
(#) Program the Baud Rate, Word Length, Stop Bit, Parity,
and Mode(Receiver/Transmitter) in the huart Emul Init structure.
(#) Initialize the UART Emulation registers software by calling the HAL_UART_Emul_Init() API.
-@- The specific UART Emulaion Handle (Transmission complete, Reception complete
and Transfer Error) will be managed using the macros HAL_UART_Emul_TxCpltCallback(),
HAL_UART_Emul_RxCpltCallback() and __HAL_UART_Emul_TranferError() inside the transmit
and receive process.
-@- These API's(HAL_UART_Emul_Init() configures also the low level Hardware GPIO, CLOCK, CORTEX...etc)
by calling the customed HAL_UART_Emul_MspInit() API.
(#) Three modes of operations are available within this driver:
*** UART Emulation mode IO operation ***
===================================
[..]
(+) Send an amount of data in non blocking mode (DMA) using HAL_UART_Emul_Transmit_DMA()
(+) At transmission end of transfer HAL_UART_Emul_TxCpltCallback is executed and user can
add his own code by customization of function pointer HAL_UART_Emul_TxCpltCallback
(+) Receive an amount of data in non blocking mode (DMA) using HAL_UART_Emul_Receive_DMA()
(+) At reception end of transfer HAL_UART_Emul_RxCpltCallback is executed and user can
add his own code by customization of function pointer HAL_UART_Emul_RxCpltCallback
(+) In case of transfer Error, HAL_UART_ErrorCallback() function is executed and user can
add his own code by customization of function pointer HAL_UART_Emul_ErrorCallback
*** UART Emulation HAL driver macros list ***
=============================================
[..]
Below the list of most used macros in UART Emulation HAL driver.
(+) __HAL_UART_EMUL_GET_FLAG : Checks whether the specified UART Emulation flag is set or not
(+) __HAL_UART_EMUL_CLEAR_FLAG : Clears the specified UART Emulation pending flag
(+) __HAL_UART_EMUL_SET_FLAG : Set the specified UART Emulation flag
2020-07-30 11:40 PM
HAL_UART_Emul_MspInit ?
2020-07-30 11:45 PM
ya this function available in stm32l4xx_hal_msp.c
currently i am facing the issue multiple bytes not working.
I am able send & receive 1byte data.
2020-07-31 01:49 AM
Did you uncomment these lines?
//while (__HAL_UART_EMUL_GET_FLAG(&UartEmulHandle, UART_EMUL_FLAG_TC) != SET)
//{}
2020-07-31 02:09 AM
ya tried, after the 1st byte Transmitting the next bytes are not Transmitting.
2020-07-31 02:57 AM
see line 348 in stm32l4xx_hal_uart_emul.c
TIM_CCxChannelCmd(TIM6, TIM_CHANNEL_1, TIM_CCx_ENABLE);
According to datasheet, TIM6 have no CCX (capture/compare) channel. It is a basic timer. Try to use another timer that have at least one CCX channel