cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L152RE NUCLEO board Uart problem

and3co
Associate
Posted on March 30, 2015 at 21:45

Hello All,

I'm a hobbyst, and recently bought a Nucleo evalboard with STM32L152RE MCU for experimenting the Cortec MCU from ST. I use the free/demo dev environment from keil(MDK V5).I also use the STMCUBE HAL library from ST. Here is the first question: Is the Cube a mature lib? is it widespread enough? will keil officially support it? After some very basic trial I wanted to try a uart funcionality of the nucleo board. here is the (relevant) content of the stm32l15xx_hal.msp.c

void
HAL_UART_MspInit(UART_HandleTypeDef *huart){
GPIO_InitTypeDef gInit;
__GPIOB_CLK_ENABLE();
__USART1_CLK_ENABLE();
gInit.Pin = GPIO_PIN_6 | GPIO_PIN_7; 
gInit.Mode = GPIO_MODE_AF_PP;
gInit.Pull = GPIO_NOPULL;
gInit.Speed = GPIO_SPEED_LOW;
gInit.Alternate = GPIO_AF7_USART1;
HAL_GPIO_Init(GPIOB,&gInit);
}

here is the (relevant) content of themain.c

uHandle.Instance = USART1; 
uHandle.Init.BaudRate = 9600;
uHandle.Init.WordLength = UART_WORDLENGTH_8B;
uHandle.Init.StopBits = UART_STOPBITS_1;
uHandle.Init.Parity = UART_PARITY_NONE;
uHandle.Init.Mode = UART_MODE_TX;
uHandle.Init.HwFlowCtl = UART_HWCONTROL_NONE;
uHandle.Init.OverSampling = UART_OVERSAMPLING_16;
if
(HAL_UART_Init(&uHandle) != HAL_OK) Error_Handler();
/* Infinite loop */
while
(1)
{
HAL_UART_Transmit(&uHandle, txBuffer, 
sizeof
(txBuffer), 1000);
}

I started a putty with same config and wait for the infinite datastream from my nucleo but I got nothing. when I try some snipetts from mbed.org those work fine, so the hardware drivers and any other thing than my program are set up properly. I spent days to get it work without success. so any help is appreciated. last question :) when I debug the application with keil V5 the debug system offers only two virtual registers, where are the rest? Thank you for your support, Tom #stm32l152re-nucleo-uart
2 REPLIES 2
Posted on March 30, 2015 at 22:03

Cube is new and immature, it's popular in some circles, less so by the people I trust here, but you're free to draw your own conclusions.

USART1, PB6, PB7, which Nucleo serial port is this, the virtual one (via USB) uses a different USART and pins. Posted an SPL example in

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Discovery/USART%20Problem%20with%20nucleo%20L152&FolderCTID=0x01200200770978C69A1141439FE559EB459D75800084C20D8867EAD444A5987D47BE638E0F&currentviews=125

.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
and3co
Associate
Posted on April 01, 2015 at 11:38

Hi Clive1,

Thank you for your response, according your previous post, and checking the schematics of the board finally I realised the port, and the pins were wrongly choosen. Shame on me :)

Do you have opinion on my third question? what is the official way to debug a MCU application dealing with some communication protocoll using keil's MDK-ARM V5?

on this link http://www.keil.com/appnotes/files/apnt_153.pdf keil demonstrate how to debug the i2c protocoll using VTREGs. (the app note was made for V2) when I start a debug session I have only two VTREGs STCLK and CORE_CLK. 

Thank you for your support,

Tom