4 years, 7 months ago.

Porting MBED for STM32L152RB

Hi everybody!!!

I have started porting Mbed to my board based on stm32l152rb. I took nucleo_l152re as a base point.

What I have done:

  1. Changed device internal header stm32l152xr.h, linker script (adopted from NUCLEO_L152RE) and startup asm file(taken from STM32CubeMX)
  2. Changed us_ticker_data.h to use TIM4 instead of TIM5
  3. Added INITIAL_SP to mbed_rtx.h

                    #elif ( defined(TARGET_STM32F070RB) ||\
                                defined(TARGET_STM32F072RB) ||\
                                defined(TARGET_STM32F302R8) ||\
                                defined(TARGET_STM32L152RB))
                    #define INITIAL_SP              (0x20004000UL)
  1. Changed PeripheralNames.h removed unnecessary peripherals.
  2. created custom_target.json

{
"WL152RB": {
        "inherits": ["FAMILY_STM32"],
        "core": "Cortex-M3",
        "extra_labels_add": ["STM32L1", "STM32L152RB"],
        "config": {
            "clock_source": {
                "help": "Mask value : USE_PLL_HSE_EXTC | USE_PLL_HSE_XTAL (need HW patch) | USE_PLL_HSI",
                "value": "USE_PLL_HSE_XTAL",
                "macro_name": "CLOCK_SOURCE"
            },
            "hse_value": {
                "help": "HSE default value is 8MHz in HAL",
                "value": "8000000",
                "macro_name": "HSE_VALUE"
            }
        },
        "device_has_add": [
            "SERIAL_ASYNCH",
            "FLASH",
            "MPU"
        ],
        "device_has_remove": [
            "LPTICKER"
        ],
        "release_versions": ["2", "5"],
        "device_name": "STM32L152RB"
    }
}

Blink example compiled without errors, but doesn't work properly. LED doesn't blink at all. I have figured out that wait(1.0) function doesn't make delay.

if I add this:

int main()
{

  while (true) {
        // Blink LED and wait 0.5 seconds
        led3 =! led3;

          for(int i = 0; i< 5000; i++){
            wait(800000);
          }

    }
}

led starts to blink.

The question is What and where I should change to make led blinking?

Problem solved!!! Thanks this https://github.com/ARMmbed/mbed-os/issues/8636

posted by John Kurban 30 Aug 2019
Be the first to answer this question.