Tutorial: PWM with DMA on ARM/Kinetis

For a project I need to change the PWM duty cycle after a PWM period is over. One way to do this is to have an interrupt at the end of the PWM period, and then set the new PWM duty (compare) register value in the interrupt. That works fine for ‘slow’ PWM frequencies, but if the PWM frequency is high, the CPU load is massively increasing. A better way is to use DMA (Direct Memory Access).

FRDM-KL25Z with DMA PWM and Logic Analyzer

FRDM-KL25Z with DMA PWM and Logic Analyzer

Continue reading

Semihosting with Kinetis Design Studio

Semihosting is a technique to do printf() debugging through an active debug connection. So instead using a physical connection like RS-232 or USB CDC, the connection to the host machine is through the debugger. This post is about enabling and using semihosting with gcc and newlib/newlib-nano in Freescale Eclipse based Kinetis Design Studio (KDS) using the GNU ARM Eclipse plugins.

Semihosting Console View with output

Semihosting Console View with output

Continue reading

Configuration Data: Using the Internal FLASH instead of an external EEPROM

Many applications need to store persistent (non-volatile) data at runtime: configuration data, error logs, sensor data, calibration values, etc. The question is: where to store that data? If it is only a few kBytes, an SD card or similar is an overkill. Adding an external EEPROM? Sure, that works, but adds an extra part to the design. Some microcontroller have internal EEPROM. But what if not? Why not using the microprocessor internal flash memory?

Internal FLASH vs. external EEPROM

Internal FLASH vs. external EEPROM

Continue reading

How to Add Register Details View in Eclipse

The standard Eclipse registers view only shows the core registers:

Standard Registers View in Eclipse

Standard Registers View in Eclipse

I think it would be great to have a view to see all the device peripheral registers too?

Embedded System Registers View

Embedded System Registers View

If you want the same, then this article is for you. It works both for stock Eclipse and Freescale Kinetis Design Studion (KDS) 🙂

Continue reading

Tutorial: Data Logger with the FRDM-K64F Board

The Freescale FRDM-K64F is a great board for data logger applications: it has a powerful ARM Cortex M4F with 120 MHz, 1 MB Flash and 256 KByte RAM. Best of all: it already has a micro SD card socket on the board :-).

Data Logger with FRDM-K64F

Data Logger with FRDM-K64F

Continue reading

Constructing a Classroom IDE with Eclipse for ARM

For the next semester I will do things differently in my advanced embedded systems programming course (INTRO) at the University of Lucerne: Instead of using the Freescale provided CodeWarrior, we will use a DIY tool chain for ARM with Eclipse Kepler.

Eclipse Kepler Ready for Classroom Usage

Eclipse Kepler Ready for Classroom Usage

That way we we can offer students an open and convenient tool chain for their lab work, course assignments and own projects both at work and at home. So this post is about spending about 30 minutes to build your own tool chain which then can passed to students and coworkers so they have a complete toolchain installed in a few minutes.

Continue reading

Joystick Shield with nRF24L01 driving a Zumo Robot

With the Joystick shield I have a convenient way to drive and control a Zumo Robot without a wired connection:

Joystick Shield with Robot

Joystick Shield with Robot

While things started promising, there was a power supply problem at the end to be solved…

Continue reading

GNU ARM Eclipse & Segger J-Link Device Name Settings

Thanks to the GNU ARM Eclipse plugins from Liviu it is easy to build and debug projects for all the different ARM cores. But I need to specify the device name in the debug configuration:

Device Name for Segger GDB Configuration

Device Name for Segger GDB Configuration

There must be an easier way for this? Yes, indeed, there is 🙂

Continue reading

Segger J-Link Firmware for OpenSDAv2

Segger just has released their OpenSDAv2 firmware. The OpenSDAv2 firmware is different from the OpenSDAv1 as it is using a different memory map and bootloader. The OpenSDAv2 e.g. is present on the new FRDM-K64F board. The availability of the Segger firmware is definitely good news for any owner of the FRDM-K64F board: so far only the CMSIS-DAP firmware was available (on top of the mbed bootloader). With this, it was not possible to use the board with CodeWarrior, except with using an external P&E Multilink or Segger J-Link. With that new Segger J-Link OpenSDAv2 firmware, I can now use the FRDM-K64F with any IDE which supports the Segger J-Link :-).

FRDM-K64F with Segger OpenSDAv2 Firmware

FRDM-K64F with Segger OpenSDAv2 Firmware

Continue reading