cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX generated code doesn't run on STM32l496 Nucleo-144 board

Dick Lin
Senior
Posted on May 03, 2018 at 18:02

Hi,

I am using STM32CubeMX generated code run on Nucleo-144 board for STM32L496ZGT MCU. When I just have 3 UART enabled in cube, the code seems work fine. After I have added more components to the cube, the code go to an startup_stm32l4a6xx.s code. Seems a exception.

Here is the init code. The issue starting MX_LPUART1_UART_Init(). If I comment this out, will exception other init code too.

Any thoughts on this failure?

Thanks,

****

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_ADC1_Init();

MX_ADC3_Init();

MX_AES_Init();

MX_CRC_Init();

MX_HASH_Init();

MX_I2C1_Init();

MX_I2C2_Init();

MX_IWDG_Init();

MX_LPUART1_UART_Init();

MX_UART4_Init();

MX_UART5_Init();

MX_USART1_UART_Init();

MX_USART2_UART_Init();

MX_USART3_UART_Init();

MX_QUADSPI_Init();

MX_RNG_Init();

MX_RTC_Init();

MX_SPI1_Init();

MX_SPI2_Init();

MX_WWDG_Init();

/* Zero fill the bss segment. */

FillZerobss:

movs r3, #0

str r3, [r2], #4

LoopFillZerobss:

ldr r3, = _ebss

cmp r2, r3

bcc FillZerobss

Note: this post was migrated and contained many threaded conversations, some content may be missing.
1 ACCEPTED SOLUTION

Accepted Solutions
Dick Lin
Senior
Posted on May 04, 2018 at 18:18

Hi Clive,

I think I messed up running stm32l4a6vgt code on Nucleo-144 which is a STM32L496. 

We are using 

stm32l4a6vgt MCU but get a Nucleo-144 board.

Thanks,

Dick

View solution in original post

10 REPLIES 10
Posted on May 03, 2018 at 23:28

Your description and code is not super helpful at identifying the issue, bit too top level and vauge. Don' t really see how it would end up in the FillZerobss code.

Is it stuck in the Error_Handler, Default_Handler or HardFault_Handler?

Perhaps get a better debugger/tool-chain so you can resolve more precisely the instructions causing the error/exception

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Dick Lin
Senior
Posted on May 04, 2018 at 18:18

Hi Clive,

I think I messed up running stm32l4a6vgt code on Nucleo-144 which is a STM32L496. 

We are using 

stm32l4a6vgt MCU but get a Nucleo-144 board.

Thanks,

Dick

Posted on May 17, 2018 at 00:30

Hi,

I am seeing the issue now and have been struggled to figure out what's the issue for couple of days and several PCs.

Here is the info

- config

   Nucleo-144

   TrueStudio v9.0.1

   STM32CubeMX 4.25.1

I am using Cube to generate the code for STM32L496. To make it simple, there is only USART1 mode set to Asynchronous. Nothing else is enabled.

The main() listed below. It's pretty straight forward.

The issue is when I use TrueSTUDIO to step into the HAL_UART_Init

(), it never return to the MX_USART1_UART_Init(). It's doesn't seem the MX_USART1_UART_Init() get the caller address right. But the program not hung, if I click suspend. It just waiting in the main::MX_USART1_UART_Init() function.

If I comment MX_USART1_UART_Init() out, will be the MX_GPIO_Init() never return to main.

Another weir thing is when I F6 step over, it's jumping around source code, not step over 1 line of code.

I haven't seen this in any IDE GDB debugger at all. And no clue at all what's happening.

Any ideas what might went wrong? 

int main(void)

{

   HAL_Init();

   SystemClock_Config();

   MX_GPIO_Init();

   MX_USART1_UART_Init();

   while (1)

   {

   }

}

Thanks,

Dick

Posted on May 17, 2018 at 00:43

Ok, again top level code is of zero probative value.

I might look in HAL_UART_MspInit() in your project's stm32l4xx_hal_msp.c file for while(1) loops of death

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2018 at 00:49

No, HAL_UART_MspInit() is fine. It stuck in UART_CheckIdleState(). Thx

On Wed, May 16, 2018 at 3:44 PM, Clive One <st-microelectronics@jiveon.com>

Posted on May 17, 2018 at 01:41

For the code generate from Cube v4.25.0 (Cube v4.25.1 generated code with compiler errors) for Nucleo-144 board (with only USART1/2/3 enabled with all other defaults, it never return on HAL_RCCEx_PeriphCLKConfig() function.

Thanks,

Dick

Posted on May 17, 2018 at 02:27

I think I've mentioned before, I don't use CubeMX

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on May 17, 2018 at 18:28

Do we have ST support can help? Thx

Posted on May 17, 2018 at 18:54

This is primarily a user-to-user forum, for more involved engineering support you'd need to be a commercial customer of some merit.

For specific tool chain and debugging issues you might have to work through them yourself, or with a colleague. The HAL examples are generally a better starting point to get orientated with.

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