cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 UART/USART receive issue(without interrupt)

C S
Associate II
Posted on September 04, 2017 at 08:51

The original post was too long to process during our migration. Please click on the attachment to read the original post.
3 REPLIES 3
Jagadish
Associate II
Posted on September 06, 2017 at 21:48

Hi Chirag,

I had faced this problem with L031 board. Have a look at the schematics --

http://www.st.com/en/microcontrollers/stm32l476rg.html

 and check if the UART pins i.e STLK_TX and STLK_RX are the same as configured using the STMCube. You can check the UART pins in a file that reads something like stm32l4xx_hal_msp.c, and search for void HAL_UART_MspInit(UART_HandleTypeDef* huart). To receive from hyperterminal these pins should match the UART pins mentioned in schematic.  

Hope this helps.

Regards,

Harsha

Posted on September 06, 2017 at 22:53

So what pins does this supposedly use? Save me having to dig through the docs for things you should already be aware of.

Does HAL_UART_Receive() return an error? When you uses a debugger what do you see in the buffer?

Note that an array with 10 elements has them numbered 0 thru 9

data1[10] = data[10]; // this is out side the bounds of the array, not clear on the purpose of this code

Try echoing back one character at a time.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Brian TIDAL
ST Employee
Posted on September 06, 2017 at 23:37

Hi Chirag,

Can you confirm you are using USART2 with PD5 (USART_TX) and PD6 (USART_RX)? Is USART2 connected to PC through the ST-Link Virtual Com Port (VCP)? In such case, there is no modification needed on the board, and you should be able to send/receive through the VCP thanks to the ST-Link USB cable. See

http://www.st.com/content/ccc/resource/technical/document/user_manual/d1/84/86/4b/08/82/47/91/DM00172179.pdf/files/DM00172179.pdf/jcr:content/translations/en.DM00172179.pdf

User manual Discovery kit with STM32L476VG MCU § 7.9 USART configuration.

I would not recommend to use PA2 and PA3 as I would conflict with JOY_RIGHT and JOY_UP (or you'll have to remove R52 & R56 resistors). 

Regards

Bruno

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.