What was missing in the FatFsMemSDHC component presented here is support for a ‘write protection’ pin. Well, that write protection is not present on micro-SD cards, and on normal SD cards it is a simple plastic thing with no real hardware meaning: it is all up to the software to respect it. While my other SD card components have support for such a write protection detection, it was lacking for the FatFsMemSDHC (for Kinetis) component. Time to fix this!
In “Tutorial: Accelerating the KL25Z Freedom Board” I used the MMA8451Q accelerometer on the FRDM-KL25Z board in a very primitive way: I’m reading directly some low-level registers from the device through an I2C low-level component. No calibrating, no special device feature setting, only raw values. Since then, things have been evolved: In “Tutorial: Creating a Processor Expert Component for an Accelerometer” I started to create a driver for this accelerometer, and since then a lot more functionality has been added.
If you are a frequent reader of this blog, then you know: I’m a big fan of Processor Expert components. While there are many Processor Expert components delivered with CodeWarrior, it lacks many components and device drivers beside of the normal on-chip peripherals. But value gets added to an embedded project with all the external devices, sensors and actuators. That’s why I have created many more components which are available on my GitHub site. Readers of this blog have asked several times to create a tutorial on how to create a Processor Expert component. So why not working on that on a long Easter weekend full of cold rain and snow?
When I have asked by a student last year if I’m uing Git, I said “Git what?”. Yep, a shame I did not know what Git was a this time. But it is never to late to learn new things.
I was coming from CVS, moved to the successor of it (SVN) and was happy with it. Especially with having a local SVN server and repository, that was (and still is) a great thing. But to truely collaborate with a worldwide community, it is time to use something different: Git.
Ahrg! Again my ARM application crashed somewhere and I ended up in a HardFault exception :-(. In my earlier post I used a handler to get information from the processor what happened. But it is painful to add this handler again and again. So I decided to make things easier for me: with a special HardFault Processor Expert component :-).
After adding this HardFault component to my project, it automatically adds an entry to the vector table. So no manual steps are needed: having the component in the project and enabled will do the needed steps.
I’m working with the I2C bus recently a lot. I’m using it in a project to reverse-engineering skimming (credit card fraud) devices. I needed to improve one of my applications for the lecture classes where a MCF52259 is communicating with a TWR-LCD display over I2C. And I want to add RTC (Real-Time-Clock) capabilities to my Arduino Data Logger Shield which requires I2C.
The same time I want to have things working with ARM Cortex-M4 and M0+ devices. And here the challenge started: using the I2C_LDD (Logical Device Driver) Processor Expert components for the ARM Kinetis devices is definitely not simple and easy. I want to use my software compatible for both the ARM cores and say for S08 and ColdFire cores. So what I ended up is to write a ‘generic’ I2C driver on top of the low level Processor Expert components: named GenericI2C.
An SD (Secure Digital) Card interface is kind of standard for many applications today: it provides a lot of memory at a reasonable cost. Still, I need a software stack for it, up to the level of a file system. So far I was really happy with using FatFs: an open source FAT file system provided by Elm-Chan. I’m using the FatFs Processor Expert component already in multiple designs. What was missing: a port to the Freescale Kinetis ARM Cortex-M4 family of processors.
The Kinetis ARM Cortex-M4(F) is a wonderful machine: a 32bit architecture, plenty of FLASH and RAM, an ideal play field. I love the Kinetis Tower boards, and even more the Freedom board which has an ARM Cortex-M0+ on it. I have a lot of projects on S08, S12 and ColdFire at the university, and they are all using a lot of Processor Expert components. Processor Expert is such a great productivity tool: having software in components allows easy software re-use. With Processor Expert abstracting from the hardware, I can easily port my applications to new boards and processors. Well, until Processor Expert changed for Kinetis :-(.
Typically a Processor Expert component creates two files: a header file and a source file. That’s fine for normal drivers. But this does not work well for more complicated things like an RTOS or communication stacks: these are built from a whole set of source files. So how can I generate multiple files with a Processor Expert Component?
Writing Processor Expert components is not always completely independent of the compiler and underlying microcontroller. In many cases I need to know the compiler for which the source code is generated. Or I need to know on which CPU architecture the code shall run. For this I need to know the compiler and the CPU family.
In my class at the university I’m using a microcontroller attached to a DC motor from Maxon. The job of the microcontroller is to implement (among other things) a PID controller for the motor speed (or position). In the lab we implement the PID and all the related parts of the control loop without Processor Expert. But it easily can be done as well with Processor Expert components, as described here.
Technically, a normal user component can implement any RTOS. This is what I did with the Micrium MicroC/OS-II component. That way the component shows up in the ‘Embedded Components’ group. But how to make it showing up as RTOS component inside the ‘Operating System’ group as the FreeRTOS component? What I want is this: to show the RTOS component under the ‘Operating System’ group of my project:
Ah, a lot of work went into a new Processor Expert component, and finally it shows up in the component library:
Oh, wait: *that* icon does not look nice enough for that amount of work behind the component?
In my previous post I mentioned the Drivers\Common folder which has ‘include’ files. These files are maintained automatically by the Component Wizard. But what is the purpose of these files?
The Common Folder has *.inc files which are included in the driver as ‘function’ header. The .inc file contains documentation about the function and parameters for that function.
What I describe here is an overview about the different locations, folder and files you will see if you are importing or developing a Processor Expert User component. I’m showing below example screenshot for the FreeRTOS component, as this is probably the most complex one I ever have created.
OK, I think this topic is a very special one, and probably not of interest of many folks out there. Or how many want to create a Processor Expert Plugin for an RTOS? Well, I did this. And I think that topic might be very controversial too, especially for all the RTOS vendors out there :-). The thoughts expressed here about creating Processor Expert components do not only apply for an RTOS, but as well for any other ‘complex’ software or stack. So if you are interested about the ‘behind the scenes’ of creating Processor Expert components, especially in the context of an RTOS, then read on ;-).
The FSL_USB_Stack Embedded Component presented in “USB CDC, reloaded” has been updated to V1.004 and is available here. I was running into issues if the USB CDC stack had to send out either 16 or 32 bytes of data in the
App_Task() function. In that case the data is not sent until the next
Inheriting Processor Expert components with CDE and the Component Wizard is easy. But sometimes it is tricky and requires some tweaking. Components should be easily accessible (see CDE: Show Inherited Methods), and names should make sense. And here is a challenge: changing the name for inherited components:
Using Processor Expert components makes my development faster and easier. And when I have a useful piece of software I want to distribute or use in another project, I transform it into a Processor Expert component. But recently I noticed a strange thing with my components: the inherited components did not show the methods and events?