SEGGER J-Link Pro: an exhaustive review

SEGGER J-Link PRO an exhaustive review

1 Meeting J-Link

In our minds, we have always seen SEGGER debugging solutions like a professional but costly tools: a debugger to perform advanced operations but definitely too much for a student. Some time ago we heard about a new version of SEGGER, the J-Link EDU, which is cheaper and addressed virtually to us. It started to take shape the idea of using it as external debugger for these ARM evaluation kit which comes without a debugger.

Some month ago SEGGER proposed a firmware suitable for STM32 Nucleo on-chip debugger which makes J-Link available also for the STM32 ecosystem and they notified us this solution commenting our STM32 Nucleo-144 review. After an exchange of reciprocal opinion they have definitely caught our attention and we have decided to ask them for a J-Link PRO in order to test it. continue reading…

Hello ChibiOS

Hello ChibiOS

1 Something more about multi-threading

One of most important feature of ChibiOS is multi-threading. Oversimplifying, a thread could be imagined like a sequence of instructions (with associated a priority and a working area) and multi-threading means kernel can manage more than a thread independently, executing them in a parallel fashion even if there is a single core.

Achieving this requires Kernel must plan operation sequence: this task is called scheduling. We could act indirectly on this operation though priority levels. Priority follows a simple rule:

among all the threads ready for execution, the one with the highest priority is the one being executed, no exceptions to this rule.

There is a nice article on chibios.org about how to create threads.Threads must always have a chThdSleep() or some suspending function inside their loop. In this way they will yield the CPU ownership and the Kernel will perform a context switch resuming the thread in ready state having the highest priority. Typically a thread is resumed on a certain event, performs its operations and than is suspended.

The best way to maximize usefulness of multi-threading is to divide our application in more independent parts and make them cooperate to achieve our purpose. Every part will represent one of ours threads.

Consider a scenario in which a LED changes its state on button pressed: we can consider this like a kind of action and reaction. So we have two task: checking the button state and changing the LED state. We can assign these tasks to two different threads, in this way code related to every task is independent from other tasks and if a task changes we don’t have to edit the whole software.

In this tutorial we are going to use the green LED and the User Button of our STM32 Nucleo-64 F401RE to explain how to use multi-threading and to introduce the PAL driver. In the following step, we will modify the LED related task without editing the one button related.

2 STM32 General Purpose I/Os

The simplest way to interact with a MCU is sampling voltages from its pins or force a signal on them. Every MCU manages its pins in different way and typically pins or pads (inspired by contact pads) are grouped by ports. continue reading…

A quick view of ChibiStudio

A quick view of ChibiStudio

1 ChibiOS based projects in ChibiStudio

1.1 How it is composed

We have said more than once that ChibiStudio is Eclipse based, therefore, should not surprise that project management is based on Eclipse rules. In Eclipse a C project is a folder containing basically a main.c, a makefile and two additional files used by eclipse to manage projects: .project and .cproject.

A ChibiOS based project
Fig.1 – A ChibiOS based project.

A ChibiOS based projects contains also three additional files:

  • chconf.h, containing configuration related to kernel. As example, here it is possible to configure system timing, enable/disable kernel features and enable/disable debug options;
  • halconf.h, containing configuration related to HAL. Here it is possible to enable/disable whole HAL modules or configure them;
  • mcuconf.h, containing specific configuration of used MCU. As example if we enable a certain module in halconf.h here we can choose how many driver assign to/enable for that module.

Even more, we have a folder named debug containing a .launch file: this is a debug configuration.

Do not worry if words are not fully comprehensible now: we will see some practical example about how to edit these files in the subsequent tutorials.

1.2 How to create a new project

The best way to create a ChibiOS based new project is to duplicate a default one from the project explorer. This procedure is shown in the video above. Of course we can assemble a new project for ChibiOS starting from an empty project, but this will be a waste of time.

For that reason it is strongly recommended not to edit default project but operate on a new one. Duplicating a default project we need to perform certain tasks before you can use the new project.

These operation are shown into the video but we want to spent a few more words. continue reading…