Skip to main content
Dick Lin
Senior
May 3, 2018
Solved

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

  • May 3, 2018
  • 10 replies
  • 1883 views
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.
    This topic has been closed for replies.
    Best answer by Dick Lin
    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

    10 replies

    Tesla DeLorean
    Guru
    May 3, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Dick Lin
    Dick LinAuthor
    Senior
    May 17, 2018
    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

    Tesla DeLorean
    Guru
    May 17, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Dick Lin
    Dick LinAuthorBest answer
    Senior
    May 4, 2018
    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