Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 7 months 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, 7 months 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
- 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".
- if defined(STM32L100xB)
- include "stm32l100xb.h"
- elif defined(STM32L100xBA)
- include "stm32l100xba.h"
- elif defined(STM32L100xC)
- include "stm32l100xc.h"
- elif defined(STM32L151xB)
- include "stm32l151xb.h"
- elif defined(STM32L151xBA)
- include "stm32l151xba.h"
- elif defined(STM32L151xC)
- include "stm32l151xc.h"
- elif defined(STM32L151xCA)
- include "stm32l151xca.h"
- elif defined(STM32L151xD)
- include "stm32l151xd.h"
- elif defined(STM32L151xE)
- include "stm32l151xe.h"
- elif defined(STM32L152xB)
- include "stm32l152xb.h"
- elif defined(STM32L152xBA)
- include "stm32l152xba.h"
- elif defined(STM32L152xC)
- include "stm32l152xc.h"
- elif defined(STM32L152xCA)
- include "stm32l152xca.h"
- elif defined(STM32L152xD)
- include "stm32l152xd.h"
- elif defined(STM32L152xE)
- include "stm32l152xe.h"
- elif defined(STM32L162xC)
- include "stm32l162xc.h"
- elif defined(STM32L162xCA)
- include "stm32l162xca.h"
- elif defined(STM32L162xD)
- include "stm32l162xd.h"
- elif defined(STM32L162xE)
- include "stm32l162xe.h"
- else
- error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
- endif
Regards, and many thanks for your support
posted by 14 Apr 2016It 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 14 Apr 2016