cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any difference between usart6 and usart 1? Usart6 gives me problems with same configuration as usart1, which is working fine.

APlöt.1
Associate II

Hello community,

I have a problem with using usart6, although usart1 is working fine.

My setup: STM32F439, usarts connected to a dual ftdi chip, so I have two com ports on the pc to choose of, which represent usart 1 on usart 6 resp.

Also direct usb connection with pc possible, via usb pins (virtual com port).

I started with usart1, which I manage to configure so to use it with HAL_UART_Receive_IT(&huart1,(uint8_t *) USART1_RX_BUF, 1)

and

HAL_UART_Transmit_IT(&huart1,(uint8_t *) TX_TEMP_BUFFER , CI_LEN)

functions.

BUT when I use USB communication as well (means, if I configure USB as well), I get errors resp. time delays it usart communication. Apparently usart1 and usb use same pins or something like that. But I need USB for the option of in field firmware updates.

So I was happy about having the hardware option to use usart6 and configured it exactly the same but it won't work.

Communication only happens once, e.g. when I want to check for the firmware version, I get an answer once, but the next command is not executed anymore. As I debugged I found that the HAL_UART_TxCpltCallback is not called (as it does with usart1).

At least HAL_UART_RxCpltCallback is called again with the next incoming command, but at some point data processing or sending the answer does not work.

Any idea out there?

What else do you need to know?

Thanks in advance for any help!

PS: I'm using atollic TrueStudio.

3 REPLIES 3

Consider interrupt priorities and preemption settings. Callbacks are done under interrupt context, and will block other code. You should always do very little in the IRQHandlers/callbacks, avoiding anything blocking in loops or waiting unnecessarily.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

They're generally the same, but use different pins and different interrupt handlers.

USART1 and USB can coexist on the same chip if you're not using hardware flow control.

If you feel a post has answered your question, please click "Accept as Solution".
APlöt.1
Associate II

Thank you very much for your replies.

Seems, that clive1's interrupt hints lead to the problem. I found some missing/wrong dma interrupt initialisations. I did not find them in the first place because I was just concentrating on the explicit USART stuff.

Well USART6 is working now and USART1 as well without interruptions. I think, the wrong dma interrupt was causing my problems there. Hardware flow control was already not enabled.

So topic solved for me, thanks again.