How to use LL (low level) drivers in CubeMX STM32? - stm32

I'm creating a blank project for a STM32F103 microcontroller using STM32CubeMX. Using HAL drivers (the default), I got a blinky example working pretty quickly, but I'd like to try out LL (low level) drivers instead of HAL.
When I go to Project > Settings > Advanced Settings in CubeMX, I see the peripherals listed, and there is a pulldown next to each one which only has one option, HAL. According to the docs this is where I could select LL or HAL for each peripheral.
How do I enable LL drivers in STM32CubeMX?
Details: I did a clean install of STM32CubeMX (4.23.0) on Ubuntu (16.04) and created a new project for STM32F103C8 microcontroller (this is on a "Blue Pill" board). I'm using SW4STM32 IDE, everything more or less worked out of the box except I had to select STLink V2 instead of V2.1 in a config file.

from project manager under advanced setting
from driver selector you can change HAL to LL for all peripherals

Currently (STM32CubeMX v4.23.0) the LL drivers are only generated for L1, L4, F2, F4, F7 series. See the chapter 6.2 STM32Cube code generation using Low Layer drivers
For STM32L1, STM32L4, STM32L4+, STM32F2, STM32F4 and STM32F7 Series,
STM32CubeMX allows generating peripheral initialization code based either on the
peripheral HAL driver or on the peripheral Low Layer (LL) driver.
http://www.st.com/content/ccc/resource/technical/document/user_manual/10/c5/1a/43/3a/70/43/7d/DM00104712.pdf/files/DM00104712.pdf/jcr:content/translations/en.DM00104712.pdf

Related

Merge two System Workbench for STM32 Projects

I configured with STM32CubeMX the UART interface for my Nucleo F446RE, it's using HAL Driver, and i want to connect it to a USB to UART Bridge so it can communicate with my GUI.
The other Project has all the programm code and it don't uses HAL Drivers.
Is there any way to merge these two Projects in System Workbench for STM32 together?

Issues in Debugging program in Atollic TrueStudio

I have designed a circuit in which I am using STM32L452RETx micro-Controller on PCB. This is basically a current sensor. I am using JTAG-20 connector for debugging. I am using Atollic TrueStudio IDE.
The issue is when I debugg program in TrueStudio by selecting JTAG option in debug configuration then it gives error saying failed to initialize the ST-Link and target not found but when I Select SWD then there is no error and it programs successfully. where as in STM32CubeMx I have set debug to JTAG 5 pin configuration as i am using JTAG 20 in hardware. (serial peripheral-> Sys -> Debug-> Jtag 5 pin). program is debugging without errors but no output at the serial terminal. serial terminal gives no hand shake error.
Can anybody tell is this right way of debugging ( SWD in TrueStudion and JTAG in STM32CubeMx) or I am making a mistake.
Regards,
The paradox is not as big as it seems:
As you can verify in the
Datasheet for STM32L452xx, DS11912 Rev.5, pages 74/75, the alternate functions of the GPIO used for JTAG and SWD are the same (always AF0, "SYS_AF").
Therefore, SWD connetion works after you configured your STM32CubeMX to JTAG (If you had configured your Cube project to SWD, JTAG wouldn't have worked because the JTDI pin (PA15) wouldn't have been connected to AF0.).
This solves the problem why SWD worked unexpectedly.
The problem why JTAG doesn't work remains.
You mentioned that you're using a JTAG-20 connector, but not which ST-Link version exactly you are using. If, for instance, you are using the ST-Link part that is embedded to a nucleo board (or discovery, or similar product of other vendors), the ST-Link pinout is limited to lines needed for SWD and SWO (together: SWV).
This is not due to limitations of TrueStudio, which does support JTAG in principle, but because one of the 5 lines may be unconnected.
Please inspect which exact ST-Link version you are using (easiest thing to check is what the ST-Link Utility program tells you), re-check your schematics and wiring from the target µC to your debug adapter.
If you don't find an obvious reason (and fix your problem this way), your problem may be an electronic one. Then it is off-topic here and (after narrowing it further) you should describe the remaining problem in Electrical Engineering Stack Exchange.
If you have an oscilloscope, it may be worth to check the signals, especially on those pins that are only on JTAG but not SWD (JTDI, JTDO, NJTRST).

Using qemu-system-gnuarmeclipse command-line for nrf52840

I want to run unit-tests for a firmware code written for nrf52840 using QEMU. I came across the GNU MCU Eclipse project which has forked the main QEMU project to provide better support for Cortex-M SoCs by allowing the creation of cortex-m devices through data definitions provided in CMSIS SVD files (as noted here). Even though the project primarily supports the STM32 based boards and MCUs, their eclipse plugin does support adding new device packs for development and debugging. But I am not able to figure out how to use their command-line tool qemu-system-gnuarmeclipse to run an ELF file created for nrf52840. I have the following questions:
How does eclipse plugin allow debugging for nrf52840 using custom SVD file even though their command-line tool doesn't have any option to provide a custom SVD file?
How can I add support for nrf52840? Can I reuse board and MCU definitions for STM32 and just provide a JSON variant for SVD file here?
See the discussion here for response to this question

How to do Simulink model run in Raspberry Pi after power on (booting) as standalone?

I build a Simulink model to control Dc motor, load into the board, stop Simulink model and plug out the power and Ethernet cable.
Does the Simulink model that has been loaded in the Raspberry Pi board work alone after Raspberry Pi power on (booting / startup) without running Simulink model again on the computer via Ethernet connection?
I assume you are using the official support package.
You will find a binary application built for your system in your home directory. The name of the folder is identical to the name of your simulink model.
You can use ssh to connect to your raspberry and start the application manually each time you boot the system. If you wish to start it automatically, check this question.
Make sure to stop the application before you use the support package to load a new application, for example when you update your model and built it again.
You can download the latest supportpackage for Raspberry Pi - 18a
They introduced "Run on Boot" feature at the Simulink config set.
You can directly add a model to startup during deployment.
Refer the supportpackage page for more information.

STM32 libraries for eclipse

Can you use the CMSIS, HAL, TM libraries for STM32F407 discovery board with eclipse, without STM32Cube? According to this link http://www.carminenoviello.com/en/2015/06/04/stm32-applications-eclipse-gcc-stcube/ you can do it with eclipse & STM32Cube. But I wonder if you can do just same thing without the STM32Cube. Since I'm using OS X, it is impossible to install the STM32Cube, but in order to use the GPIO library I need to use CMSIS, HAL, TM libraries.
You might be able to used the older "Standard Peripheral Driver" model - which was a just a distributed set of driver files specific to the chip. These libraries are no longer supported and are replaced by STM32Cube which generates equivalent code - but with better support for hardware abstraction however they are still very useable.
Search "STM32F4xx_StdPeriph_Driver" to locate the libraries (which include the standard peripheral drivers and CMSIS).
You can download the libraries as a separate zip file
http://www.st.com/web/en/catalog/tools/PF259243
just unpack it and import whatever you need from it into your project. You can take an example project which is closest to your needs, and start developing your application from that. That's what I did in Linux.
There is the STM32CubeMX, which is the installable program you're referring to, and there are STM32CubeF4, STM32CubeL0, etc, which are the firmware package for the different controller families.
CubeMX now officially supports Mac and Linux. However here is an old post how to run it manually http://www.carminenoviello.com/2015/09/09/running-stm32cubemx-macos-finally/.
Regarding the HAL and SPL I'll add that there are really nice libraries in libopencm3 which are developed by community and are not so "buggy" as HAL or SPL.
I found an interesting instruction. You can install the STM32CubeMX on OS X. http://www.stm32duino.com/viewtopic.php?t=267
There is an Eclipse based IDE by OpenSTM32 community called SW4STM32. Available at OpenSTM32 community's site. System Workbench for STM32 installer has been released on the following platforms:
Microsoft Windows Vista and newer (32 bits or 64 bits)
Linux (32 bits or 64 bits)
Mac OSX 10.10 Yosemite and newer + Xcode 7
Java SE JRE 7 or newer
When creating a project you can choose which library you want want to use, SPL, HAL or baremetal.
STM32CubeMX is a initialization code generator. It definitely eases development, but you can write you code completely from the beginning.
STM32CubeMX uses HAL as its Library. You can download the HAL and Include the files that you need and write down the code from scratch. You just need to be aware of the APIs, which are documented in UM1725 Application Note.
But, now STM32CubeMX is also available for Linux and Mac.