8 years ago.

does mBed support the STM32L151?

Hi,

I am currently using mBed with the NUCLEO-L152 board.

We plan to use the STM32L151 microcontroller in a new design, does anybody know if mBed is compatible with the STM32L151?

What do I need to change if I want to port (to the STM23L151) the projects created for the NUCLEO-L152?

Regards

1 Answer

8 years ago.

Hello,
STM32L151 and STM32L152 are compatible devices, they even share the same datasheet...
The only difference is that the STM32L151 does not have the segment LCD controller while the STM32L152 does.
There is no mbed platform for the STM32L151, but the STM32L152 can run code made for the STM32L151.
The opposite is also true as long as the LCD is not used.
Best regards

Hi Maxime,

thanks for your answer.

By looking at the "stm32l1xx.h", CMSIS STM32L1xx Device Peripheral Access Layer Header File, I realized that you can select the target device. By default it is as follows

  1. define STM32L152xC /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */

Do I need to comment this line and uncomment the following if I want to use the STM32L151C6?

/* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */

I understood that STM32L151 and STM32L152 are compatible, but I could see some differences in the following CMSIS Cortex-M3 Device Peripheral Access Layer Header Files defined in the "stm32l1xx.h".

  1. if defined(STM32L100xB)
  2. include "stm32l100xb.h"
  3. elif defined(STM32L100xBA)
  4. include "stm32l100xba.h"
  5. elif defined(STM32L100xC)
  6. include "stm32l100xc.h"
  7. elif defined(STM32L151xB)
  8. include "stm32l151xb.h"
  9. elif defined(STM32L151xBA)
  10. include "stm32l151xba.h"
  11. elif defined(STM32L151xC)
  12. include "stm32l151xc.h"
  13. elif defined(STM32L151xCA)
  14. include "stm32l151xca.h"
  15. elif defined(STM32L151xD)
  16. include "stm32l151xd.h"
  17. elif defined(STM32L151xE)
  18. include "stm32l151xe.h"
  19. elif defined(STM32L152xB)
  20. include "stm32l152xb.h"
  21. elif defined(STM32L152xBA)
  22. include "stm32l152xba.h"
  23. elif defined(STM32L152xC)
  24. include "stm32l152xc.h"
  25. elif defined(STM32L152xCA)
  26. include "stm32l152xca.h"
  27. elif defined(STM32L152xD)
  28. include "stm32l152xd.h"
  29. elif defined(STM32L152xE)
  30. include "stm32l152xe.h"
  31. elif defined(STM32L162xC)
  32. include "stm32l162xc.h"
  33. elif defined(STM32L162xCA)
  34. include "stm32l162xca.h"
  35. elif defined(STM32L162xD)
  36. include "stm32l162xd.h"
  37. elif defined(STM32L162xE)
  38. include "stm32l162xe.h"
  39. else
  40. error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
  41. endif

Regards, and many thanks for your support

posted by Francisco Vázquez 14 Apr 2016

It is usualy easier to modify the product #define inside the toolchain configuration.
This is beter so you don't have to alter the library.
This is how it is done for generated/exported projects.
Just change the product definition to mach with the one of the product you want to use.

For example in keil:
Project => option for target xxx => C/C++ => Prepocessor Symbols => Define
In IAR:
Project>options => C/C++ Compiler => Preprocessor => Defined symbols
In SWSTM32:
Project => properties => C/C++ Build => Settings => Tool Settings => MCU GCC Compiler/Symbols => Defined symbols (-D)

You may also need to adapt the linker configuration if your device does not have the same memory size, so the linker knows were to place your application

posted by Maxime TEISSIER 14 Apr 2016